本文包含了以下两个知识点:
静默安装Oracle 19c;
通过rman升级数据库。
一、静默安装Oracle 19c
1.1 安装并配置Gird组件
创建响应文件grid.rsp,内容如下:
oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v19.0.0
INVENTORY_LOCATION=/u01/app/oraInventory
oracle.install.option=HA_CONFIG
ORACLE_BASE=/u01/app/grid
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=asmoper
oracle.install.asm.OSASM=asmadmin
oracle.install.crs.config.scanType=LOCAL_SCAN
oracle.install.crs.config.SCANClientDataFile=
oracle.install.crs.config.gpnp.scanName=db-cluster-scan
oracle.install.crs.config.gpnp.scanPort=1521
oracle.install.crs.config.ClusterConfiguration=STANDALONE
oracle.install.crs.config.configureAsExtendedCluster=false
oracle.install.crs.config.memberClusterManifestFile=
oracle.install.crs.config.clusterName=db-cluster
oracle.install.crs.config.gpnp.configureGNS=false
oracle.install.crs.config.autoConfigureClusterNodeVIP=false
oracle.install.crs.config.gpnp.gnsOption=
oracle.install.crs.config.gpnp.gnsClientDataFile=
oracle.install.crs.config.gpnp.gnsSubDomain=
oracle.install.crs.config.gpnp.gnsVIPAddress=
oracle.install.crs.config.sites=
oracle.install.crs.config.clusterNodes=
oracle.install.crs.config.networkInterfaceList=
oracle.install.crs.configureGIMR=false
oracle.install.asm.configureGIMRDataDG=false
oracle.install.crs.config.storageOption=
oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations=
oracle.install.crs.config.sharedFileSystemStorage.ocrLocations=
oracle.install.crs.config.useIPMI=false
oracle.install.crs.config.ipmi.bmcUsername=
oracle.install.crs.config.ipmi.bmcPassword=
oracle.install.asm.SYSASMPassword=abcABC12
oracle.install.asm.diskGroup.name=DATA
oracle.install.asm.diskGroup.redundancy=EXTERNAL
oracle.install.asm.diskGroup.AUSize=4
oracle.install.asm.diskGroup.FailureGroups=
oracle.install.asm.diskGroup.disksWithFailureGroupNames=/dev/sdb,
oracle.install.asm.diskGroup.disks=/dev/sdb
oracle.install.asm.diskGroup.quorumFailureGroupNames=
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/sd*
oracle.install.asm.monitorPassword=abcABC12
oracle.install.asm.gimrDG.name=
oracle.install.asm.gimrDG.redundancy=
oracle.install.asm.gimrDG.AUSize=1
oracle.install.asm.gimrDG.FailureGroups=
oracle.install.asm.gimrDG.disksWithFailureGroupNames=
oracle.install.asm.gimrDG.disks=
oracle.install.asm.gimrDG.quorumFailureGroupNames=
oracle.install.asm.configureAFD=true
oracle.install.crs.configureRHPS=false
oracle.install.crs.config.ignoreDownNodes=false
oracle.install.config.managementOption=NONE
oracle.install.config.omsHost=
oracle.install.config.omsPort=0
oracle.install.config.emAdminUser=
oracle.install.config.emAdminPassword=
oracle.install.crs.rootconfig.executeRootScript=true
oracle.install.crs.rootconfig.configMethod=ROOT
oracle.install.crs.rootconfig.sudoPath=
oracle.install.crs.rootconfig.sudoUserName=
oracle.install.crs.config.batchinfo=
oracle.install.crs.app.applicationAddress=
oracle.install.crs.deleteNode.nodes=
如果使用AFD新特性,那么在安装之前,必须更改磁盘属主为grid用户,这里使用了两块磁盘:sdb和sdc,更改属主如下:
[root@db03 ~]# chown grid:oinstall /dev/sd{b,c}
使用下面的命令进行安装配置:
[grid@db03 ~]$ cd $ORACLE_HOME
[grid@db03 grid]$ unzip /u02/software/19c/LINUX.x64_193000_grid_home.zip
[grid@db03 grid]$ ./gridSetup.sh -silent -ignorePrereq -responseFile /tmp/grid.rsp
响应文件里,默认只创建了一个data磁盘组,如果还需要创建其他的磁盘组,以FRA磁盘组为例,使用下面的命令:
[grid@db03 grid]$ asmca -silent -createDiskGroup -diskGroupName FRA -diskList /dev/sdc -redundancy EXTERNAL -autoLabel -au_size 4 -sysAsmPassword abcABC12
–更改资源ora.driver.afd的组为oinstall,默认为asmadmin。
[grid@db03 ~]$ crsctl modify resource ora.driver.afd -attr “ACL=’owner:grid:rwx,pgrp:oinstall:r-x,other::r–,user:grid:r-x’ ” -init
[grid@db03 ~]$ crsctl stat res ora.driver.afd -p|head -4
1.2 安装database组件
创建响应文件db.rsp,内容如下:
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.ConfigureAsContainerDB=false
oracle.install.db.config.PDBName=
oracle.install.db.config.starterdb.characterSet=
oracle.install.db.config.starterdb.memoryOption=false
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.password.ALL=
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.password.PDBADMIN=
oracle.install.db.config.starterdb.managementOption=DEFAULT
oracle.install.db.config.starterdb.omsHost=
oracle.install.db.config.starterdb.omsPort=0
oracle.install.db.config.starterdb.emAdminUser=
oracle.install.db.config.starterdb.emAdminPassword=
oracle.install.db.config.starterdb.enableRecovery=false
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
使用下面的命令开始安装:
[oracle@db03 ~]$ cd $ORACLE_HOME
[oracle@db03 db_1]$ unzip /u02/software/19c/LINUX.x64_193000_db_home.zip
[oracle@db03 db_1]$ ./runInstaller -silent -ignorePrereq -responseFile /tmp/db.rsp
[root@db03 ~]# /u01/app/oracle/product/19.0.0/db_1/root.sh
到此,整个19c的环境搭建完毕。
二、迁移准备工作
注意:新旧环境的数据库实例名必须保持一致。
2.1 创建参数文件
使用18c的spfile创建pfile,并复制到19c的目录。
SQL> create pfile=’/tmp/initcdb.ora’ from spfile;
[oracle@db01 ~]$ scp /tmp/initcdb.ora db03:$ORACLE_HOME/dbs
2.2 拷贝密码文件
将18c的密码参数文件复制到19c的目录。
[oracle@db01 ~]$ scp $ORACLE_HOME/dbs/orapwcdb db03:$ORACLE_HOME/dbs
2.3 创建adump目录
必须创建19c的adumo文件夹,否则使用pfile初次启动实例会报错。
[oracle@db03 ~]$ mkdir -p /u01/app/oracle/admin/cdb/adump
2.4 备份18c数据库
[oracle@db01 ~]$ rman target /
run {
allocate channel c1 device type disk;
backup database format ‘/u02/orabak/rhndb_%U’;
sql ‘alter system archive log current’;
backup format ‘/u02/orabak/%d_arch_%s_%p_%h’ archivelog all delete all input;
backup format ‘/u02/orabak/controlfile_%d_%s_%p’ current controlfile;
release channel c1;
}
备份后的文件名如下图所示:
三、正式迁移过程
整个过程就是一个异机恢复过程。只不过在恢复完成后,要以upgrade方式打开数据库,完成后续升级操作。
3.1 恢复控制文件
[oracle@db03 ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 – Production on Sun May 5 15:47:32 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> set dbid 2122265785
executing command: SET DBID
RMAN> startup nomount;
Oracle instance started
Total System Global Area 4294965360 bytes
Fixed Size 9144432 bytes
Variable Size 771751936 bytes
Database Buffers 3506438144 bytes
Redo Buffers 7630848 bytes
RMAN> restore controlfile from ‘/u02/orabak/controlfile_CDB_19_1’;
Starting restore at 05-MAY-2019 15:48:12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=773 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output file name=+DATA/CDB/CONTROLFILE/current.257.1007480897
output file name=+FRA/CDB/CONTROLFILE/current.256.1007480897
Finished restore at 05-MAY-2019 15:48:19
RMAN> alter database mount;
released channel: ORA_DISK_1
Statement processed
3.2 创建spfile并注册资源
RMAN> create spfile=’+data/cdb/spfilecdb.ora’ from pfile;
Statement processed
[oracle@db03 ~]$ srvctl add database -db cdb -oraclehome /u01/app/oracle/product/19.0.0/db_1 -pwfile $ORACLE_HOME/dbs/orapwcdb -spfile ‘+DATA/CDB/spfilecdb.ora’ -dbname cdb -diskgroup data,fra
[oracle@db03 ~]$ echo ‘SPFILE=’+DATA/CDB/spfilecdb.ora” >$ORACLE_HOME/dbs/initcdb.ora
3.3 恢复整个数据库
–在rman中运行如下命令进行全库恢复
run {
allocate channel c1 device type disk;
restore database;
recover database;
release channel c1;
}
恢复完成后,以upgrade方式打开数据库并向temp表空间添加数据文件:
RMAN> alter database open resetlogs upgrade;
RMAN> alter tablespace temp add tempfile ‘+data’ size 50M autoextend on next 100m maxsize unlimited;
3.4 执行dbupgrade进行升级操作
[oracle@db03 ~]$ dbupgrade -u sys
Argument list for [/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/catctl.pl]
For Oracle internal use only A = 0
Run in c = 0
Do not run in C = 0
Input Directory d = 0
Echo OFF e = 1
Simulate E = 0
Forced cleanup F = 0
Log Id i = 0
Child Process I = 0
Log Dir l = 0
Priority List Name L = 0
Upgrade Mode active M = 0
SQL Process Count n = 0
SQL PDB Process Count N = 0
Open Mode Normal o = 0
Start Phase p = 0
End Phase P = 0
Reverse Order r = 0
AutoUpgrade Resume R = 0
Script s = 0
Serial Run S = 0
RO User Tablespaces T = 0
Display Phases y = 0
Debug catcon.pm z = 0
Debug catctl.pl Z = 0
catctl.pl VERSION: [19.0.0.0.0]
STATUS: [Production]
BUILD: [RDBMS_19.3.0.0.0DBRU_LINUX.X64_190417]
/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/orahome = [/u01/app/oracle/product/19.0.0/db_1]
/u01/app/oracle/product/19.0.0/db_1/bin/orabasehome = [/u01/app/oracle/product/19.0.0/db_1]
catctlGetOraBaseLogDir = [/u01/app/oracle/product/19.0.0/db_1]
Analyzing file /u01/app/oracle/product/19.0.0/db_1/rdbms/admin/catupgrd.sql
Log file directory = [/tmp/cfgtoollogs/upgrade20190505160915]
catcon::set_log_file_base_path: ALL catcon-related output will be written to [/tmp/cfgtoollogs/upgrade20190505160915/catupgrd_catcon_44738.lst]
catcon::set_log_file_base_path: catcon: See [/tmp/cfgtoollogs/upgrade20190505160915/catupgrd*.log] files for output generated by scripts
catcon::set_log_file_base_path: catcon: See [/tmp/cfgtoollogs/upgrade20190505160915/catupgrd_*.lst] files for spool files, if any
Enter Password:
Number of Cpus = 4
Database Name = cdb
DataBase Version = 18.0.0.0.0
catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/cdb/upgrade20190505160957/catupgrdcdbroot_catcon_44738.lst]
catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/cdb/upgrade20190505160957/catupgrdcdbroot*.log] files for output generated by scripts
catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/cdb/upgrade20190505160957/catupgrdcdbroot_*.lst] files for spool files, if any
Log file directory = [/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/cdb/upgrade20190505160957]
Parallel SQL Process Count (PDB) = 2
Parallel SQL Process Count (CDB$ROOT) = 4
Concurrent PDB Upgrades = 2
Generated PDB Inclusion:[PDB$SEED RHNDB SPWDB]
Components in [CDB$ROOT]
Installed [APS CATALOG CATJAVA CATPROC CONTEXT DV JAVAVM OLS ORDIM OWM SDO XDB XML XOQ]
Not Installed [APEX EM MGW ODM RAC WK]
……
Grand Total Time: 2468s [SPWDB]
LOG FILES: (/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/cdb/upgrade20190505160957/catupgrdspwdb*.log)
Upgrade Summary Report Located in:
/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/cdb/upgrade20190505160957/upg_summary.log
Time: 1992s For CDB$ROOT
Time: 4505s For PDB(s)
Grand Total Time: 6497s
LOG FILES: (/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/cdb/upgrade20190505160957/catupgrdcdbroot*.log)
Upgrade Summary Report Located in:
/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/cdb/upgrade20190505160957/upg_summary.log
Grand Total Upgrade Time: [0d:1h:48m:17s]
如果源库中存在多个pdb,那么这个升级过程会比较耗时。
接着运行以下两个脚本:
SQL> shutdown immediate
SQL> startup upgrade
SQL> @?/rdbms/admin/utlirp.sql
SQL> shutdown immediate
SQL> startup
SQL> @?/rdbms/admin/utlrp.sql
升级完成后,可以验证所有的组件以升级到19.0.0.0版本,如下图所示:
col comp_name for a40
set wrap off
set pagesize 999
select comp_name,version, status from dba_registry;
今天的文章oracle18c升级19,Upgrading Oracle 18c To 19c分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:http://bianchenghao.cn/64561.html