HƯỚNG DẪN UPGRADE ORACLE 12C LÊN 19C – Nâng cấp Oracle database lên 19C từ bản 12C sử dụng 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.
Các thông số cơ bản:
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
19C:
Đã cài đặt Oracle Software
Dbname: là tên DB của 12c đang chạy
Home: /u01/app/oracle/product/19.0.0/dbhome_1
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).
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 |
Login vào database hiện tại 12c Chạy lệnh này:
sqlplus / as sysdba @/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. |
Thoát ra ngoài OS thhự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: export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1 export ORACLE_SID=duodb export PATH=$ORACLE_HOME/bin:$PATH dbua //chạy DBUA để tiến hành nâng cấp |
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
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 |
Hệ thống thông báo upgrade thành công.
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; |
Chúc các bạn thành công !!!
Nếu bạn có bất cứ câu hỏi nào, đừng ngần ngại để lại lời nhắn, tôi sẽ hỗ trợ bạn !!!