3.5,重启监听 standby
[Oracle@powerlong5 dbs]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-FEB-2015 15:41:36
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.121.218)(PORT=1521)))
The command completed successfully
[oracle@powerlong5 dbs]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-FEB-2015 15:41:41
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /oracle/app/oracle/diag/tnslsnr/powerlong5/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.121.218)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.121.218)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 10-FEB-2015 15:41:41
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/app/oracle/diag/tnslsnr/powerlong5/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.121.218)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "powerdes" has 1 instance(s).
Instance "powerdes", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@powerlong5 dbs]$
3.6,恢复数据库
在standby库上操作
[oracle@powerlong5 admin]$ rman target sys/syxxlxxxx58@PD1 auxiliary /
Argument Value Description
-----------------------------------------------------------------------------
target quoted-string connect-string for target database
catalog quoted-string connect-string for recovery catalog
nocatalog none if specified, then no recovery catalog
cmdfile quoted-string name of input command file
log quoted-string name of output message log file
trace quoted-string name of output debugging message log file
append none if specified, log is opened in append mode
debug optional-args activate debugging
msgno none show RMAN-nnnn prefix for all messages
send quoted-string send a command to the media manager
pipe string building block for pipe names
timeout integer number of seconds to wait for pipe input
checksyntax none check the command file for syntax errors
-----------------------------------------------------------------------------
Both single and double quotes (' or ") are accepted for a quoted-string.
Quotes are not required unless the string contains embedded white-space.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00552: syntax error in command line arguments
RMAN-01009: syntax error: found "end-of-file": expecting one of: "double-quoted-string, identifier, single-quoted-string, "
RMAN-01007: at line 0 column 0 file: command line arguments
[oracle@powerlong5 admin]$
[oracle@powerlong5 admin]$
[oracle@powerlong5 admin]$
报错,看下是否standby没有启动导致?
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
SQL> SQL> startup nomount
ORA-00845: MEMORY_TARGET not supported on this system
SQL>
[root@powerlong5 ~]# mount -t tmpfs shmfs -o size=12g /dev/shm
[root@powerlong5 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 57G 45G 8.9G 84% /
tmpfs 12G 0 12G 0% /dev/shm
/dev/sda1 190M 51M 129M 29% /boot
/dev/sr0 4.1G 4.1G 0 100% /media/CentOS_6.4_Final
shmfs 12G 0 12G 0% /dev/shm
[root@powerlong5 ~]#
SQL> startup
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9925
SQL> startup nomount
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9925
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9925
SQL>
去primary库上查询下audit路径
SQL> show parameter audit_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest string /oracle/app/oracle/admin/powerdes/adump
SQL>
然后在standby上操作
SQL> startup nomount
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> shutdown
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1.1358E+10 bytes
Fixed Size 2216744 bytes
Variable Size 8589937880 bytes
Database Buffers 2751463424 bytes
Redo Buffers 13946880 bytes
SQL>
去primary修改sys密码:
SQL> alter user sys identified by "syxxlxxxx58";
User altered.
SQL>
在standby库执行rman target sys/syspl1758@PD1 auxiliary /,如下所示:
[oracle@powerlong5 ~]$ rman target sys/syspl1758@PD1 auxiliary /
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Feb 7 19:08:16 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: POWERDES (DBID=3391761643)
connected to auxiliary database: POWERDES (not mounted)
RMAN> run {
allocate auxiliary channel c1 device type disk;
allocate auxiliary channel c2 device type disk;
duplicate target database for standby nofilenamecheck dorecover;
release channel c1;
release channel c2;
}
2> 3> 4> 5> 6> 7>
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=767 device type=DISK
allocated channel: c2
channel c2: SID=1150 device type=DISK
Starting Duplicate Db at 07-FEB-15
contents of Memory Script:
{
set until scn 10903678943;
restore clone standby controlfile;
}
executing Memory Script
executing command: SET until clause
Starting restore at 07-FEB-15
channel c1: starting datafile backup set restore
channel c1: restoring control file
channel c1: reading from backup piece /oracle/app/oracle/flash_recovery_area/PDUNQ/backupset/2015_02_07/o1_mf_ncsnf_TAG20150207T182252_bfct20tb_.bkp
channel c1: piece handle=/oracle/app/oracle/flash_recovery_area/PDUNQ/backupset/2015_02_07/o1_mf_ncsnf_TAG20150207T182252_bfct20tb_.bkp tag=TAG20150207T182252
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:01
output file name=/oracle/data_ora/powerdes/control01.ctl
output file name=/oracle/app/oracle/flash_recovery_area/powerdes/control02.ctl
Finished restore at 07-FEB-15
contents of Memory Script:
{
sql clone \'alter database mount standby database\';
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set until scn 10903678943;
set newname for datafile 1 to
\"/home/oradata/pwerdes/system01.dbf\";
set newname for datafile 2 to
\"/home/oradata/pwerdes/sysaux01.dbf\";
set newname for datafile 3 to
\"/home/oradata/pwerdes/undotbs01.dbf\";
set newname for datafile 4 to
\"/home/oradata/pwerdes/users01.dbf\";
set newname for datafile 6 to
\"/home/oradata/pwerdes/plas01.dbf\";
set newname for datafile 7 to
\"/home/oradata/pwerdes/pl01.dbf\";
set newname for datafile 8 to
\"/home/oradata/pwerdes/help01.dbf\";
set newname for datafile 9 to
\"/home/oradata/pwerdes/adobelc01.dbf\";
set newname for datafile 10 to
\"/home/oradata/pwerdes/sms01.dbf\";
restore
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 07-FEB-15
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to /home/oradata/pwerdes/system01.dbf
channel c1: restoring datafile 00002 to /home/oradata/pwerdes/sysaux01.dbf
channel c1: restoring datafile 00003 to /home/oradata/pwerdes/undotbs01.dbf
channel c1: restoring datafile 00004 to /home/oradata/pwerdes/users01.dbf
channel c1: restoring datafile 00006 to /home/oradata/pwerdes/plas01.dbf
channel c1: restoring datafile 00007 to /home/oradata/pwerdes/pl01.dbf
channel c1: restoring datafile 00008 to /home/oradata/pwerdes/help01.dbf
channel c1: restoring datafile 00009 to /home/oradata/pwerdes/adobelc01.dbf
channel c1: restoring datafile 00010 to /home/oradata/pwerdes/sms01.dbf
channel c1: reading from backup piece /oracle/app/oracle/flash_recovery_area/PDUNQ/backupset/2015_02_07/o1_mf_nnndf_TAG20150207T182252_bfcsvxoz_.bkp
channel c1: piece handle=/oracle/app/oracle/flash_recovery_area/PDUNQ/backupset/2015_02_07/o1_mf_nnndf_TAG20150207T182252_bfcsvxoz_.bkp tag=TAG20150207T182252
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:04:05
Finished restore at 07-FEB-15
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=3 STAMP=871067691 file name=/home/oradata/pwerdes/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=4 STAMP=871067691 file name=/home/oradata/pwerdes/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=871067691 file name=/home/oradata/pwerdes/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=6 STAMP=871067691 file name=/home/oradata/pwerdes/users01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=7 STAMP=871067691 file name=/home/oradata/pwerdes/plas01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=8 STAMP=871067691 file name=/home/oradata/pwerdes/pl01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=9 STAMP=871067691 file name=/home/oradata/pwerdes/help01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=10 STAMP=871067692 file name=/home/oradata/pwerdes/adobelc01.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=11 STAMP=871067692 file name=/home/oradata/pwerdes/sms01.dbf
contents of Memory Script:
{
set until scn 10903678943;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 07-FEB-15
starting media recovery
archived log for thread 1 with sequence 302 is already on disk as file /oracle/app/oracle/flash_recovery_area/archivelog/1_302_870804216.dbf
archived log file name=/oracle/app/oracle/flash_recovery_area/archivelog/1_302_870804216.dbf thread=1 sequence=302
media recovery complete, elapsed time: 00:00:00
Finished recover at 07-FEB-15
Finished Duplicate Db at 07-FEB-15
released channel: c1
released channel: c2
RMAN> exit
3.7 standby上修改参数文件
先关闭oracle
shutdown immediate
然后开始修改参数文件
cd $ORACLE_HOME/dbs
vim initpowerdes.ora
# 主要是修改db_unique_name
*.db_unique_name='pdunq_dg'
*.diagnostic_dest='/oracle/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=powerdesXDB)'
*.fal_client='PD1'
*.fal_server='PD2'
*.global_names=FALSE
*.job_queue_processes=1000
*.log_archive_config='DG_CONFIG=(pdunq,pddgunq)'
重新创建参数文件
create spfile from pfile;
3.8 启动数据库
startup nomount;
alter database mount standby database;
alter database add standby logfile;
alter database add standby logfile;
alter database add standby logfile;
alter database recover managed standby database using current logfile disconnect from session;