首先从源端环境获取pfile,然后进行修改,以下为修改好的参数文件,可用于恢复目标库。
然后在节点1,编辑好参数文件:
下述代码加粗的表示需要修改或者注意的地方。
[oracle@golddb1 rman]$ cat /soft/rman/pfile_gold_20190918.ora
*.audit_file_dest=’/u01/app/oracle/admin/gold/adump’
*.audit_trail=‘NONE’
*.compatible='11.2.0.4.0’
*.control_files=’+DATA/GOLD/CONTROLFILE/control01.ctl’,’+DATA/GOLD/CONTROLFILE/control02.ctl’#Restore Controlfile
*.db_block_size=8192
*.db_domain=’’
*.db_name=‘gold’
*.db_unique_name=‘GOLD’
*.diagnostic_dest=’/u01/app/oracle’
*.dispatchers=’(PROTOCOL=TCP) (SERVICE=goldXDB)’
*.log_archive_dest_1='LOCATION=+ARCH/'
*.log_archive_dest_state_1=‘ENABLE’
*.log_archive_format=‘arch_%t_%s_%r.dbf’
*.open_cursors=300
*.processes=1000
*.remote_login_passwordfile=‘EXCLUSIVE’
*.sessions=1105
*.standby_file_management=‘AUTO’
*.undo_tablespace=‘UNDOTBS1’
[oracle@golddb1 rman]$
新建下列目录(用于审计文件/节点1、2均做)
mkdir -p /u01/app/oracle/admin/gold/adump
节点1启动实例进程
sqlplus / as sysdba
create spfile from pfile=’/soft/rman/pfile_gold_20190918.ora’;
startup nomount;
exit;
rman target /
run
{
allocate channel c1 type disk;
restore controlfile from '/soft/rman/20190712/cf_opt_c-3028359837-20190712-01';
release channel c1;
}
加载数据库
alter database mount;
注册备份恢复目录
rman target /
CATALOG START WITH ‘/soft/rman/20190712/’;
exit;
more /home/oracle/scripts/restore.sh
source /home/oracle/.bash_profile
log_dir=/home/oracle/scripts/
dt=`date+%y%m%d%H%M%S`
export log_dir
export dt
$ORACLE_HOME/bin/rman target=/ log=$log_dir/log_restore_$dt.log <
nohup sh restore.sh &
等待执行结果
或者使用查看进程
ps -ef |grep rman
waitting…
…
…
…
[oracle@golddb1 scripts]$ tail -f log_restore_.log
renamed tempfile 1 to +DATA/ in control file
renamed tempfile 2 to +DATA/ in control file
released channel: c1
released channel: c2
released channel: c3
released channel: c4
RMAN>
Recovery Manager complete.
until…
sqlplus / as sysdba
alter database rename file '/u02/redo/gold/redo04.log' to '+ARCH/GOLD/ONLINELOG/redo04.log';
alter database rename file '/u02/redo/gold/redo05.log' to '+ARCH/GOLD/ONLINELOG/redo05.log';
alter database rename file '/u02/redo/gold/redo06.log' to '+ARCH/GOLD/ONLINELOG/redo06.log';
more /home/oracle/scripts/recover.sh
source /home/oracle/.bash_profile
log_dir=/home/oracle/scripts/
dt=`date+%y%m%d%H%M%S`
export log_dir
export dt
$ORACLE_HOME/bin/rman target=/ log=$log_dir/log_recover_$dt.log <
[oracle@golddb1 scripts]$ nohup sh /home/oracle/scripts/recover.sh &
waitting…
…
…
…
[oracle@golddb1 scripts]$ tail -f log_recover_.log
released channel: c4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/18/2019 13:31:15
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 1014 and starting SCN of 8098654444
RMAN>
Recovery Manager complete.
until…
rman target /
recover database until scn 8098654444;
exit;
修改数据库内存大小
避免后续升级报share pool 的错误
sqlplus / as sysdba
alter system set sga_target=70G scope=spfile;
alter system set sga_max_size=70G scope=spfile;
alter system set pga_aggregate_target=20G scope=spfile;
shutdown immediate;
startup mount;
在升级之前先查看组件状态
如果存在组件失效,建议先编译生效
set linesize 300
col comp_name for a60
select comp_id,comp_name,version,status from dba_registry;
—check valid
cd /u01/app/oracle/product/11.2.0.4/db_1/rdbms/admin/
sqlplus / as sysdba
alter database open upgrade;
spool /home/oracle/catupgrd_20190918.txt
@catupgrd.sql
sqlplus / as sysdba
startup;
set linesize 300
col comp_name for a60
select comp_id,comp_name,version,status from dba_registry;
COMP_ID COMP_NAME VERSION STATUS
------------------------------ ------------------------------------------------------------ ------------------------------ ----------------------
OWB OWB 11.2.0.3.0 VALID
APEX Oracle Application Express 3.2.1.00.12 VALID
EM Oracle Enterprise Manager 11.2.0.4.0 VALID
AMD OLAP Catalog 11.2.0.4.0 VALID
SDO Spatial 11.2.0.4.0 VALID
ORDIM Oracle Multimedia 11.2.0.4.0 VALID
XDB Oracle XML Database 11.2.0.4.0 VALID
CONTEXT Oracle Text 11.2.0.4.0 VALID
EXF Oracle Expression Filter 11.2.0.4.0 VALID
RUL Oracle Rules Manager 11.2.0.4.0 INVALID
OWM Oracle Workspace Manager 11.2.0.4.0 VALID
COMP_ID COMP_NAME VERSION STATUS
------------------------------ ------------------------------------------------------------ ------------------------------ ----------------------
CATALOG Oracle Database Catalog Views 11.2.0.4.0 VALID
CATPROC Oracle Database Packages and Types 11.2.0.4.0 VALID
JAVAVM JServer JAVA Virtual Machine 11.2.0.4.0 VALID
XML Oracle XDK 11.2.0.4.0 VALID
CATJAVA Oracle Database Java Packages 11.2.0.4.0 VALID
APS OLAP Analytic Workspace 11.2.0.4.0 VALID
XOQ Oracle OLAP API 11.2.0.4.0 VALID
18 rows selected.
SQL>
cd /u01/app/oracle/product/11.2.0.4/db_1/rdbms/admin/
sqlplus / as sysdba
@utlrp.sql
SQL> set linesize 300
SQL> col comp_name for a60
SQL> select comp_id,comp_name,version,status from dba_registry;
COMP_ID COMP_NAME VERSION STATUS
------------------------------ ------------------------------------------------------------ ------------------------------ ----------------------
OWB OWB 11.2.0.3.0 VALID
APEX Oracle Application Express 3.2.1.00.12 VALID
EM Oracle Enterprise Manager 11.2.0.4.0 VALID
AMD OLAP Catalog 11.2.0.4.0 VALID
SDO Spatial 11.2.0.4.0 VALID
ORDIM Oracle Multimedia 11.2.0.4.0 VALID
XDB Oracle XML Database 11.2.0.4.0 VALID
CONTEXT Oracle Text 11.2.0.4.0 VALID
EXF Oracle Expression Filter 11.2.0.4.0 VALID
RUL Oracle Rules Manager 11.2.0.4.0 VALID
OWM Oracle Workspace Manager 11.2.0.4.0 VALID
COMP_ID COMP_NAME VERSION STATUS
------------------------------ ------------------------------------------------------------ ------------------------------ ----------------------
CATALOG Oracle Database Catalog Views 11.2.0.4.0 VALID
CATPROC Oracle Database Packages and Types 11.2.0.4.0 VALID
JAVAVM JServer JAVA Virtual Machine 11.2.0.4.0 VALID
XML Oracle XDK 11.2.0.4.0 VALID
CATJAVA Oracle Database Java Packages 11.2.0.4.0 VALID
APS OLAP Analytic Workspace 11.2.0.4.0 VALID
XOQ Oracle OLAP API 11.2.0.4.0 VALID
18 rows selected.
SQL>
[oracle@golddb1 ~]$ vi pfile_gold1_new_20190918.ora
gold1.__db_cache_size=60397977600
gold2.__db_cache_size=60397977600
gold1.__java_pool_size=1879048192
gold2.__java_pool_size=1879048192
gold1.__large_pool_size=805306368
gold2.__large_pool_size=805306368
gold1.__pga_aggregate_target=21206401024
gold2.__pga_aggregate_target=21206401024
gold1.__sga_target=73551314944
gold2.__sga_target=73551314944
gold1.__shared_io_pool_size=0
gold2.__shared_io_pool_size=0
gold1.__shared_pool_size=9932111872
gold2.__shared_pool_size=9932111872
gold1.__streams_pool_size=0
gold2.__streams_pool_size=0
gold1.__oracle_base=’/u01/app/oracle’#ORACLE_BASE set from environment
gold2.__oracle_base=’/u01/app/oracle’#ORACLE_BASE set from environment
*.audit_file_dest=’/u01/app/oracle/admin/gold/adump’
*.audit_trail=‘NONE’
*.compatible='11.2.0.4.0’
*.control_files=’+DATA/gold/controlfile/control01.ctl’,’+DATA/gold/controlfile/control02.ctl’#Restore Controlfile
*.db_block_size=8192
*.db_domain=’’
*.db_name=‘gold’
*.db_unique_name=‘GOLD’
*.diagnostic_dest=’/u01/app/oracle’
*.dispatchers=’(PROTOCOL=TCP) (SERVICE=goldXDB)’
*.log_archive_dest_1='LOCATION=+ARCH/'
*.log_archive_dest_state_1=‘ENABLE’
*.log_archive_format=‘arch_%t_%s_%r.dbf’
*.open_cursors=300
*.pga_aggregate_target=20971520000
*.processes=1000
*.remote_login_passwordfile=‘EXCLUSIVE’
*.sessions=1105
*.sga_max_size=73400320000
*.sga_target=73400320000
gold1.undo_tablespace=‘UNDOTBS1’
gold2.undo_tablespace='UNDOTBS2’
*.cluster_database=true
*.db_create_file_dest=’+DATA’
gold1.instance_number=1
gold2.instance_number=2
*gold2.thread=2
gold1.thread=1
.undo_management=‘AUTO’
*.remote_listener='gold-scan:1521’
按照上述修改。
create spfile='+DATA' from pfile='/home/oracle/pfile_gold1_new_20190918.ora';
create pfile='/home/oracle/pfile_gold1_new_20190918.ora' from spfile='/u01/app/oracle/product/11.2.0.4/db_1/dbs/spfilegold1.ora';
su - grid
asmcmd
ASMCMD> cd DATA/GOLD/PARAMETERFILE
ASMCMD> ls
spfile.272.1019315119
ASMCMD> pwd
+data/gold/parameterfile
ASMCMD>
ASMCMD>
ASMCMD>
ASMCMD> mkalias '+DATA/GOLD/PARAMETERFILE/spfile.297.1019320369' '+DATA/GOLD/spfilegold.ora'
su - oracle
sqlplus / as sysdba
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
.4/db_1/dbs/spfilegold1.ora
shutdown immediate;
create spfile from pfile='/home/oracle/pfile_gold1_new_20190918.ora';
scp /home/oracle/pfile_gold1_new_20190918.ora golddb2:/home/oracle/pfile_gold2_new_20190918.ora
su - oracle
sqlplus / as sysdba
create spfile from pfile='/home/oracle/pfile_gold2_new_20190918.ora';
节点1
su - oracle
vi $ORACLE_HOME/dbs/initgold1.ora
spfile='+DATA/GOLD/spfilegold.ora'
sqlplus / as sysdba
startup;
节点2
su - oracle
vi $ORACLE_HOME/dbs/initgold2.ora
spfile='+DATA/GOLD/spfilegold.ora'
sqlplus / as sysdba
startup;
su - oracle
srvctl add database -d GOLD -o /u01/app/oracle/product/11.2.0.4/db_1 -p '+DATA/GOLD/spfilegold.ora'
srvctl add instance -d gold -i gold1 -n golddb1
srvctl add instance -d gold -i gold2 -n golddb2
sqlplus / as sysdba
shutdown immediate;
节点1
su - grid
srvctl start database -d GOLD
srvctl stop database -d GOLD
邮箱:[email protected]
昵称:A这货不是DBA
人生短暂,何须惨淡!
欢迎指正,共同学习!