Thứ Năm, 4 tháng 9, 2025

Nâng cấp Oracle database 12C lên 19C sử dụng DBUA | Upgrade oracle database 12c to 19c using DBUA

Nâng cấp Oracle database 12C lên 19C sử dụng DBUA | Upgrade oracle database 12c to 19c using DBUA

Để nâng cấp CSDL Oracle có nhiều phương pháp có thể áp dụng như:

  • Database Upgrade Assistant (DBUA)
  • Manual Upgrade
  • Transportable Tablespaces
  • Data Pump export/import
  • Oracle Streams
  • Oracle GoldenGate

Trong hướng dẫn này chúng ta sẽ sử dụng Database Upgrade Assistant (DBUA) để thực hiện nâng cấp CSDL oracle lên phiên bản mới hơn, từ 12c lên 19c.

Nâng cấp Oracle database 12C lên 19C sử dụng DBUA | Upgrade oracle database 12c to 19c using DBUA

Các thông số cơ bản trước khi chúng ta thực hiện nâng cấp:

DB 12C:  

Đã cài đặt sẵn CSDL và đang chạy bình thường
Dbname: duodb
Home: /u01/app/oracle/product/12.2.0/dbhome_1

Nếu bạn chưa có DB12c thì xem bài viết này để tiến hành cài đặt:  Cài đặt Oracle Database 12c trên RHEL / CentOS 7

DB 19C:

Đã cài đặt Oracle Software: trên cùng server DB12c chúng ta tiến hành cài đặt Oracle Software của phiên bản DB 19c, nhớ là chỉ cài software thôi nhé, chưa tạo database.
Dbname: là tên DB của 12c đang chạy, Dbname: duodb
Home: /u01/app/oracle/product/19.0.0/dbhome_1

Nếu bạn chưa biết cách cài đặt Oracle database software 19c như thế nào thì bạn xem thông tin trong bài viết này nhé: Cài đặt Oracle Database 19c trên Oracle Linux 7 (OL7)

Chỉ cài đặt Software Only mà chưa tạo database

word image 759 29

 

Tại DB12c:

Startup database bình thường (DB đang runing)

sqlplus / as sysdba
startup

//Kết quả

ORACLE instance started.

Total System Global Area 1828716544 bytes

Fixed Size 8621856 bytes

Variable Size 553648352 bytes

Database Buffers 1258291200 bytes

Redo Buffers 8155136 bytes

Database mounted.

Database opened.

// Kiểm tra thông số hiện tại:

select version,name,open_mode from v$instance,v$database;

VERSION NAME OPEN_MODE

—————– ——— ——————–

12.2.0.1.0 DUODB READ WRITE

Kiểm tra và đảm bảo rằng 100% các tác vụ đang backup là hoàn thành

SELECT * FROM v$backup WHERE status != 'NOT ACTIVE';

no rows selected

Làm sạch thùng rác:

PURGE DBA_RECYCLEBIN;

DBA Recyclebin purged.

Chạy gather statistics:

EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;

PL/SQL procedure successfully completed.

Stop listener nếu có/đang chạy:

OS:

lsnrctl stop LISTENER

//kết quả

LSNRCTL for Linux: Version 12.2.0.1.0 – Production on 12-APR-2024 15:34:31
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused

Chuẩn bị tài nguyên upgrade:

Chạy lệnh bên dưới để chuẩn bị các bước upgrade (DB12c): hệ thống sẽ tự sinh ra script để chúng ta có thể chạy nâng cấp DB

Lưu ý: CSDL phần mềm Oracle 19c phải được cài đặt software đúng theo đường dẫn bên dưới trước khi thực hiện (ko tạo DB, chỉ cài software). nếu đường dẫn DB_home 19c các bạn tạo khác theo hướng dẫn này thì bạn thay đúng theo của bạn nhé

OS:

java -jar /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/preupgrade.jar TEXT TERMINAL

//kết quả

Report generated by Oracle Database Pre-Upgrade Information Tool Version

19.0.0.0.0 Build: 1 on 2024-04-12T15:35:17

Upgrade-To version: 19.0.0.0.0

=======================================

Status of the database prior to upgrade

=======================================

Database Name: DUODB

Container Name: DUODB

Container ID: 0

Version: 12.2.0.1.0

DB Patch Level: No Patch Bundle applied

Compatible: 12.2.0

Blocksize: 8192

Platform: Linux x86 64-bit

Timezone File: 26

Database log mode: ARCHIVELOG

Readonly: FALSE

Edition: EE

Execute fixup scripts as indicated below:

Before upgrade:

Log into the database and execute the preupgrade fixups

@/u01/app/oracle/cfgtoollogs/duodb/preupgrade/preupgrade_fixups.sql

After the upgrade:

Log into the database and execute the postupgrade fixups

@/u01/app/oracle/cfgtoollogs/duodb/preupgrade/postupgrade_fixups.sql

Các bạn chú ý 2 đường dẫn màu đỏ bên trên và lưu lại nhé, nó sẽ dùng để chạy sscript về sau.

Login vào database hiện tại DB12c Chạy lệnh này:

sqlplus / as sysdba
startup
@/u01/app/oracle/cfgtoollogs/duodb/preupgrade/preupgrade_fixups.sql

//kết quả

Executing Oracle PRE-Upgrade Fixup Script

Auto-Generated by: Oracle Preupgrade Script

Version: 19.0.0.0.0 Build: 1

Generated on: 2024-04-12 15:35:14

For Source Database: DUODB

Source Database Version: 12.2.0.1.0

For Upgrade to Version: 19.0.0.0.0

Preup Preupgrade

Action Issue Is

Number Preupgrade Check Name Remedied Further DBA Action

—— ———————— ———- ——————————–

1. pre_fixed_objects YES None.

2. tablespaces_info NO Informational only.

Further action is optional.

3. rman_recovery_version NO Informational only.

Further action is optional.

The fixup scripts have been run and resolved what they can. However, there are still issues originally identified by the preupgrade that have not been remedied and are still present in the database.

Depending on the severity of the specific issue, and the nature of the issue itself, that could mean that your database is not ready for upgrade. To resolve the outstanding issues, start by reviewing the preupgrade_fixups.sql and searching it for the name of the failed CHECK NAME or Preupgrade Action Number listed above.

There you will find the original corresponding diagnostic message from the preupgrade which explains in more detail what still needs to be done.

PL/SQL procedure successfully completed.

Sau đó => Thoát ra ngoài OS thực hiện lệnh bên dưới: (DB 19c đã được cài đặt software trong thư mục mặc định từ trước), lệnh này nhằm mục đích gán biến môi trường và dbhome để có thể chạy dbua từ bản 19c:

OS: //chạy DBUA để tiến hành nâng cấp

export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export ORACLE_SID=duodb
export PATH=$ORACLE_HOME/bin:$PATH
dbua

Hệ thống sẽ xuất hiện bảng hướng dẫn các bước thực hiện nâng cấp, chúng ta làm theo hướng dẫn

word image 576 1

Kiểm tra thông tin tiến hành nâng cấp xem có đúng chưa

Nhập user sys, mật khẩu vào: oracle

word image 576 2

word image 576 3

word image 576 4

word image 576 5

word image 576 6

word image 576 7

word image 576 8

word image 576 9

word image 576 10

Hệ thống thông báo nâng cấp thành công và hiển thị các thông tin tương ứng, các bạn check lại thông tin nhé

word image 576 11

Hệ thống thông báo upgrade thành công.

Sau khi hệ thống tiến hành nâng cấp xong => Login vào sqlplus và chạy lệnh này

@/u01/app/oracle/cfgtoollogs/duodb/preupgrade/postupgrade_fixups.sql

database upgrade 12c 19c

 

Kiểm tra các thông số sau nâng cấp:

select VERSION,name,open_mode from v$instance,v$database;
SELECT * FROM v$timezone_file;
select TZ_VERSION from registry$database;

word image 576 12

Như vậy là chúng ta đã hoàn thành nâng cấp Database từ 12c lên 19c rồi bạn nhé

Các bạn nhớ sửa lại thông tin trong .bash_profile để phù hợp với CSDL DB19c mới nhé: Từ lần tới nếu tiến hành khởi động lại thì nó tự nạp biến môi trường trong bash_profile mới mà chúng ta không cần phải thực hiện export biến ra nữa.

19c bash profile

Chúc các bạn thành công !!!

=============================
Website không chứa bất kỳ quảng cáo nào, mọi đóng góp để duy trì phát triển cho website (donation) xin vui lòng gửi về STK 90.2142.8888 - Ngân hàng Vietcombank Thăng Long - TRAN VAN BINH
=============================
Nếu bạn không muốn bị AI thay thế và tiết kiệm 3-5 NĂM trên con đường trở thành DBA chuyên nghiệp hay làm chủ Database thì hãy đăng ký ngay KHOÁ HỌC ORACLE DATABASE A-Z ENTERPRISE, được Coaching trực tiếp từ tôi với toàn bộ bí kíp thực chiến, thủ tục, quy trình của gần 20 năm kinh nghiệm (mà bạn sẽ KHÔNG THỂ tìm kiếm trên Internet/Google) từ đó giúp bạn dễ dàng quản trị mọi hệ thống Core tại Việt Nam và trên thế giới, đỗ OCP.
- CÁCH ĐĂNG KÝ: Gõ (.) hoặc để lại số điện thoại hoặc inbox https://m.me/tranvanbinh.vn hoặc Hotline/Zalo 090.29.12.888
- Chi tiết tham khảo:
https://bit.ly/oaz_w
=============================
2 khóa học online qua video giúp bạn nhanh chóng có những kiến thức nền tảng về Linux, Oracle, học mọi nơi, chỉ cần có Internet/4G:
- Oracle cơ bản: https://bit.ly/admin_1200
- Linux: https://bit.ly/linux_1200
=============================
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH:
📧 Mail: binhoracle@gmail.com
☎️ Mobile/Zalo: 0902912888
👨 Facebook: https://www.facebook.com/BinhOracleMaster
👨 Inbox Messenger: https://m.me/101036604657441 (profile)
👨 Fanpage: https://www.facebook.com/tranvanbinh.vn
👨 Inbox Fanpage: https://m.me/tranvanbinh.vn
👨👩 Group FB: https://www.facebook.com/groups/DBAVietNam
👨 Website: https://www.tranvanbinh.vn
👨 Blogger: https://tranvanbinhmaster.blogspot.com
🎬 Youtube: https://www.youtube.com/@binhguru
👨 Tiktok: https://www.tiktok.com/@binhguru
👨 Linkin: https://www.linkedin.com/in/binhoracle
👨 Twitter: https://twitter.com/binhguru
👨 Podcast: https://www.podbean.com/pu/pbblog-eskre-5f82d6
👨 Địa chỉ: Tòa nhà Sun Square - 21 Lê Đức Thọ - Phường Mỹ Đình 1 - Quận Nam Từ Liêm - TP.Hà Nội

=============================
cở sở dữ liệu, cơ sở dữ liệu quốc gia, database, AI, trí tuệ nhân tạo, artificial intelligence, machine learning, deep learning, LLM, ChatGPT, DeepSeek, Grok, oracle tutorial, học oracle database, Tự học Oracle, Tài liệu Oracle 12c tiếng Việt, Hướng dẫn sử dụng Oracle Database, Oracle SQL cơ bản, Oracle SQL là gì, Khóa học Oracle Hà Nội, Học chứng chỉ Oracle ở đầu, Khóa học Oracle online,sql tutorial, khóa học pl/sql tutorial, học dba, học dba ở việt nam, khóa học dba, khóa học dba sql, tài liệu học dba oracle, Khóa học Oracle online, học oracle sql, học oracle ở đâu tphcm, học oracle bắt đầu từ đâu, học oracle ở hà nội, oracle database tutorial, oracle database 12c, oracle database là gì, oracle database 11g, oracle download, oracle database 19c/21c/23c/23ai, oracle dba tutorial, oracle tunning, sql tunning , oracle 12c, oracle multitenant, Container Databases (CDB), Pluggable Databases (PDB), oracle cloud, oracle security, oracle fga, audit_trail,oracle RAC, ASM, oracle dataguard, oracle goldengate, mview, oracle exadata, oracle oca, oracle ocp, oracle ocm , oracle weblogic, postgresql tutorial, mysql tutorial, mariadb tutorial, ms sql server tutorial, nosql, mongodb tutorial, oci, cloud, middleware tutorial, docker, k8s, micro service, hoc solaris tutorial, hoc linux tutorial, hoc aix tutorial, unix tutorial, securecrt, xshell, mobaxterm, putty
Sửa bài viết

ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master