从12.2开始,可以支持使用 AutoUpgrade Tool 从11.2.0.4 直接升级到12.2,18.5, 19.3
AutoUpgrade Tool 是一个jar 包,在19.3以上的版本里面,自带该软件包,位置在$ORACLE_HOME/rdbms/admin/autoupgrade.jar
不过,ORACLE推荐下载最新的JAR包,通过 :Doc ID 2485457.1 文档可以找到。
下载后,替换 $ORACLE_HOME/rdbms/admin/autoupgrade.jar 即可。
使用这个工具,可以同时升级在一台机器上的多套库。
不过,使用这个工具 ,有两个前提
1.数据库开启归档,
否则,升级检查会报错:
Error: UPG-1303
orcl ARCHIVE_MODE_ON - PreChecks.executeChecks
2.设置快速恢复区
否则,会报错:
orcl FLASH_RECOVERY_AREA_SETUP - PreChecks.executeChecks
以下看操作步骤:
1.查看autoupgrade.jar 的帮助
java -jar autoupgrade.jar -h
usage: java -jar autoupgrade.jar [-version | -help | -create_sample_file <create_sample_file>] [-settings <settings>] [-config <config>]
[-clear_recovery_data] [-mode <mode>] [-console | -noconsole] [-restore_on_fail] [-debug] [-zip] [-sid <sid>] [-d <d>]
-version Displays the current build of the jar
-help Displays the available options
-create_sample_file <create_sample_file> Creates a sample configuration file that be used as reference
config - Creates a sample configuration file
settings - Creates a sample internal configuration file to allow a deeper low level configuration
-settings <settings> Path to config file to overwrite internal settings
-config <config> User config file with the databases to upgrade
-clear_recovery_data Remove the recovery checkpoint to start fresh the next time the tool is launched
-mode <mode> Mode on which the AutoUpgrade will start and behave
analyze - Executes the checks and generates a report of the database status
deploy - Performs the upgrade of the databases from start to end
fixups - Executes the checks and pre-upgrade fixups but do not start the upgrade
upgrade - Performs the database upgrade and post-upgrade actions. The database must already be up and running
with the target home
-console Start the AutoUpgrade with the console enabled (default)
-noconsole Start the AutoUpgrade with the console disabled
-restore_on_fail If present, when a job fails, the database is restored automatically. Errors in PDBs are not considered fatal,
only errors in CDB$ROOT or Non-CDBs
-debug Debug messages enabled
-zip Zips up log files required for filing an AutoUpgrade service request.
-sid <sid> Zip file will contain all the SIDs that are given in a comma separated list.
-d <d> Path to save AutoUpgrade zip file
The config option with sample parameter creates a sample database configuration file with default values.
Or you can use it with a custom database configuration file with an execution mode (deploy, analyze, fixups or upgrade).
The settings parameter lets you use a file with Autoupgrade internal settings, can be default for base settings or you can specify a file path for custom
settings.
Unrecognized option: [-h]
2.看一下包版本
[oracle@dbserver admin]$ java -jar autoupgrade.jar -version
build.hash 6010a62
build.version 19.8.1
build.date 2020/04/01 16:18:24
build.max_target_version 19
build.type production
3.创建配置文件
[oracle@dbserver admin]$ java -jar /u19c/app/oracle/product/19/db_1/rdbms/admin/autoupgrade.jar -create_sample_file config
Created sample configuration file /u19c/app/oracle/product/19/db_1/rdbms/admin/sample_config.cfg
4.修改配置文件
vim /u19c/app/oracle/product/19/db_1/rdbms/admin/sample_config.cfg
upg1.dbname=emrep
upg1.start_time=NOW
upg1.source_home=/u01/app/oracle/product/12.1.0/dbhome_1
upg1.target_home=/u19c/app/oracle/product/19/db_1
upg1.sid=emrep
upg1.log_dir=/home/oracle/upg_logs
upg1.upgrade_node=dbserver
upg1.target_version=19
5.拷贝这个文件到/home/oracle/scripts/DB12.cfg
cp /u19c/app/oracle/product/19/db_1/rdbms/admin/sample_config.cfg /home/oracle/scripts/DB19.cfg
6.分析
您可以直接运行自动升级,但是最好的做法是首先运行分析。 一旦分析阶段顺利通过,就可以自动升级数据库。
java -jar /u19c/app/oracle/product/19/db_1/rdbms/admin/autoupgrade.jar -config /home/oracle/scripts/DB12.cfg -mode analyze
您将会看到如下输出:
Autoupgrade tool launched with default options
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 databases will be analyzed
Type 'help' to list console commands
upg> Job 100 completed
------------------- Final Summary --------------------
Number of databases [ 1 ]
Jobs finished successfully [1]
Jobs failed [0]
Jobs pending [0]
------------- JOBS FINISHED SUCCESSFULLY -------------
Job 100 FOR DB19
数据库可以自动升级。
7.部署模式
当您现在使用-mode deploy启动升级时,该工具将重复分析阶段,但是除此之外会额外添加修复、升级和升级后的步骤。
java -jar /u19c/app/oracle/product/19/db_1/rdbms/admin/autoupgrade.jar -config /home/oracle/scripts/DB12.cfg -mode deploy
您将会看到如下输出:
Autoupgrade tool launched with default options
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 databases will be processed
Type 'help' to list console commands
upg>
现在,您可以立即监视升级,稍微扩展xterm的宽度,以免换行。
最常用的监控命令如下:
lsj – 列出作业编号和有关每个活动作业的概述信息
upg> lsj
+----+-------+---------+---------+-------+--------------+--------+--------+------------+
|Job#|DB_NAME| STAGE|OPERATION| STATUS| START_TIME|END_TIME| UPDATED| MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+--------+------------+
| 101| emrep|DBUPGRADE|EXECUTING|RUNNING|20/04/22 14:59| N/A|15:15:37|32%Upgraded |
+----+-------+---------+---------+-------+--------------+--------+--------+------------+
Total jobs 1
status -job <number> – 查看特定作业的具体细节信息
或者,你也可以监控/home/oracle/logs/DB12/101下的日志。在子目录./dbupgrade 下,可以找到每个工作进程各自的日志文件。
根据您的硬件配置的不同,升级将需要20-45分钟。 您不必一直等待至脚本运行完成,而可以继续进行下一章实验的内容(插入多租户数据库UPGR至CDB2)。
运行一段时间后,执行lsj命令
AutoUpgrade程序还将完成重新编译,时区更改并更新密码文件,spfile和/etc/oratab。
|