`

oracle 11g 利用duplicate from active database 创建data guard

 
阅读更多

操作系统版本:
oracle@admtps-Sun-Fire-X4150:/media/oracle/fast_recovery_area$ uname -a
Linux admtps-Sun-Fire-X4150 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:17:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

数据库版本:
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production

SQL>

数据库规划(db_unique_name):
主库: DREAM
备库: DREAM01

操作步骤如下:

1.检查主库是否为归档模式,并且主库为force logging,(database flashback模式可选,选择有利于备库在failover模式迅速恢复)

SQL> select log_mode,force_logging from v$database;

LOG_MODE FOR
------------ ---
ARCHIVELOG NO

SQL> alter database force logging;

Database altered.

SQL> select log_mode,force_logging from v$database;

LOG_MODE FOR
------------ ---
ARCHIVELOG YES

SQL>

2.检查是否创建standby log file,假如没有创建,则创建
standby log file的文件大小和redo log file 文件大小一样,并且组数为redo log group count * thread count + 1


SQL> select * from v$logfile;
rows will be truncated


GROUP# STATUS TYPE MEMBER
---------- ------- ------- -----------------------------------------------------
3 ONLINE /media/oracle/oradata/DREAM/redo03.log
2 ONLINE /media/oracle/oradata/DREAM/redo02.log
1 ONLINE /media/oracle/oradata/DREAM/redo01.log

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- ---------- --- ----------
1 1 4 52428800 512 1 YES INACTIVE
2 1 5 52428800 512 1 NO CURRENT
3 1 3 52428800 512 1 YES INACTIVE

SQL> select 52428800/1024/1024 from dual;

52428800/1024/1024
------------------
50

SQL> alter database add standby logfile '/media/oracle/oradata/DREAM/stdlog04.log' size 50m;

Database altered.

SQL> alter database add standby logfile '/media/oracle/oradata/DREAM/stdlog05.log' size 50m;

Database altered.

SQL> alter database add standby logfile '/media/oracle/oradata/DREAM/stdlog06.log' size 50m;

Database altered.

SQL> alter database add standby logfile '/media/oracle/oradata/DREAM/stdlog07.log' size 50m;

Database altered.

SQL> select * from v$standby_log;

GROUP# DBID THREAD# SEQUENCE# ARC ST
---------- ---------------------------------------- ---------- ---------- --- --
4 UNASSIGNED 0 0 YES UN
5 UNASSIGNED 0 0 YES UN
6 UNASSIGNED 0 0 YES UN
7 UNASSIGNED 0 0 YES UN

SQL> select * from v$logfile;
rows will be truncated


GROUP# STATUS TYPE MEMBER
---------- ------- ------- -----------------------------------------------------
3 ONLINE /media/oracle/oradata/DREAM/redo03.log
2 ONLINE /media/oracle/oradata/DREAM/redo02.log
1 ONLINE /media/oracle/oradata/DREAM/redo01.log
4 STANDBY /media/oracle/oradata/DREAM/stdlog04.log
5 STANDBY /media/oracle/oradata/DREAM/stdlog05.log
6 STANDBY /media/oracle/oradata/DREAM/stdlog06.log
7 STANDBY /media/oracle/oradata/DREAM/stdlog07.log

7 rows selected.

SQL>

3,修改主数据库配置DATAGUARD参数:

alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(DREAM,DREAM01)';

alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=DREAM';

alter system set LOG_ARCHIVE_DEST_2='SERVICE=DREAM01 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DREAM01';

alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;

alter system set FAL_SERVER=DREAM01;

alter system set FAL_CLIENT=DREAM;

alter system set DB_FILE_NAME_CONVERT='/media/oracle/oradata/DREAM01/','/media/oracle/oradata/DREAM/' scope=spfile;

alter system set LOG_FILE_NAME_CONVERT='/media/oracle/oradata/DREAM01/','/media/oracle/oradata/DREAM/' scope=spfile;


SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(DREAM,DREAM01)';

System altered.

SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=DREAM';

System altered.

SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=DREAM01 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DREAM01';

System altered.

SQL> alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;

System altered.

SQL> alter system set FAL_SERVER=DREAM01;

System altered.

SQL> alter system set FAL_CLIENT=DREAM;

System altered.

SQL> alter system set DB_FILE_NAME_CONVERT='/media/oracle/oradata/DREAM01/','/media/oracle/oradata/DREAM/' scope=spfile;

System altered.

SQL> alter system set LOG_FILE_NAME_CONVERT='/media/oracle/oradata/DREAM01/','/media/oracle/oradata/DREAM/' scope=spfile;

System altered.

SQL>


4,配置主备监听器,tnsname.ora文件,使双方可以连上:

oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin$ vi listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ATS.COM)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = ATS)
)
(SID_DESC =
(GLOBAL_DBNAME = DREAM.COM)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = dream)
)
(SID_DESC =
(GLOBAL_DBNAME = DREAM01.COM)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = dream01)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = admtps-Sun-Fire-X4150)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

ADR_BASE_LISTENER = /u01/app/oracle


oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin$ lsnrctl reload

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 10-MAY-2012 17:05:41

Copyright (c) 1991, 2010, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=admtps-Sun-Fire-X4150)(PORT=1521)))
The command completed successfully
oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 10-MAY-2012 17:05:48

Copyright (c) 1991, 2010, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=admtps-Sun-Fire-X4150)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 09-MAY-2012 15:46:55
Uptime 1 days 1 hr. 18 min. 52 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/admtps-Sun-Fire-X4150/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=admtps-Sun-Fire-X4150)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "ATS.COM" has 2 instance(s).
Instance "ATS", status UNKNOWN, has 1 handler(s) for this service...
Instance "ATS", status READY, has 1 handler(s) for this service...
Service "ATSXDB.COM" has 1 instance(s).
Instance "ATS", status READY, has 1 handler(s) for this service...
Service "DREAM.COM" has 2 instance(s).
Instance "DREAM", status UNKNOWN, has 1 handler(s) for this service...
Instance "DREAM", status READY, has 1 handler(s) for this service...
Service "DREAM01.COM" has 1 instance(s).
Instance "DREAM01", status UNKNOWN, has 1 handler(s) for this service...
Service "DREAMXDB.COM" has 1 instance(s).
Instance "DREAM", status READY, has 1 handler(s) for this service...
The command completed successfully
oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin$

编辑 tnsnames.ora文件 添加

DREAM01 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.201)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DREAM01.COM)
)
)

配置完毕以后用tnsping看是否能够相互ping通;

SQL> host;
oracle@admtps-Sun-Fire-X4150:/media/oracle/fast_recovery_area$ tnsping dream

TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 05-JUN-2012 16:16:25

Copyright (c) 1997, 2010, Oracle. All rights reserved.

Used parameter files:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = admtps-Sun-Fire-X4150)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DREAM.COM)))
OK (0 msec)
oracle@admtps-Sun-Fire-X4150:/media/oracle/fast_recovery_area$ tnsping dream01

TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 05-JUN-2012 16:16:33

Copyright (c) 1997, 2010, Oracle. All rights reserved.

Used parameter files:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.201)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DREAM01.COM)))
OK (0 msec)

oracle@admtps-Sun-Fire-X4150:/media/oracle/fast_recovery_area$

5.配置standby database

5.1拷贝主库的密码文件到备机,然后改成备库自己的

oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/dbs$ cp orapwDREAM orapwDREAM01


5.2创建备库初始化参数:

oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/dbs$ more initDREAM01.ora
db_name = 'DREAM01'
db_unique_name = 'DREAM'
db_domain = 'COM'

5.3创建备库文件存放路径:

SQL> show parameter user_dump_dest

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
user_dump_dest string /media/oracle/diag/rdbms/dream

oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/dbs$mkdir /media/oracle/oradata/DREAM01

oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/dbs$mkdir /media/oracle/diag/rdbms/dream01

5.4用SQLPLUS启动备库到nomount状态:

oracle@admtps-Sun-Fire-X4150:/media/oracle/fast_recovery_area$ export ORACLE_SID=DREAM01
oracle@admtps-Sun-Fire-X4150:/media/oracle/fast_recovery_area$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Tue Jun 5 16:29:50 2012

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile="/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initDREAM01.ora"
ORACLE instance started.

Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
SQL> host;
oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/dbs$

5.5 用rman在主库上连接主库和辅助库(备库),执行创建备库操作:

rman duplicate.log

conn target sys/@dream;
conn auxiliary sys/@dream01;

run {
duplicate target database for standby from active database
spfile
parameter_value_convert 'DREAM','DREAM01'
set db_unique_name='DREAM01'
set db_file_name_convert='/DREAM/','/DREAM01/'
set log_file_name_convert='/DREAM/','/DREAM01/'
set control_files='/media/oracle/oradata/DREAM01/control01.ctl'
set log_archive_max_processes='5'
set fal_client='DREAM01'
set fal_server='DREAM'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(dream,dream01)'
set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=DREAM01'
set log_archive_dest_2='service=dream ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=DREAM';
}

oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin$ rman

Recovery Manager: Release 11.2.0.2.0 - Production on Tue Jun 5 17:44:14 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

RMAN> connect target sys@dream

target database Password:
connected to target database: DREAM (DBID=3778928932)

RMAN> connect auxiliary sys@dream01

auxiliary database Password:
connected to auxiliary database: DREAM (not mounted)

RMAN> run {
duplicate target database for standby from active database
spfile
parameter_value_convert 'DREAM','DREAM01'
set db_unique_name='DREAM01'
set db_file_name_convert='/DREAM/','/DREAM01/'
set log_file_name_convert='/DREAM/','/DREAM01/'
set control_files='/media/oracle/oradata/DREAM01/control01.ctl'
set log_archive_max_processes='5'
set fal_client='boston'
set fal_server='chicago'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(dream,dream01)'
set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=DREAM01'
set log_archive_dest_2='service=dream ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=DREAM';
}2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16>

Starting Duplicate Db at 05-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=91 device type=DISK

contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdream' auxiliary format
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdream01' targetfile
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileDREAM.ora' auxiliary format
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfiledream01.ora' ;
sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfiledream01.ora''";
}
executing Memory Script

Starting backup at 05-JUN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=98 device type=DISK
Finished backup at 05-JUN-12

sql statement: alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfiledream01.ora''

contents of Memory Script:
{
sql clone "alter system set audit_file_dest =
''/media/oracle/admin/DREAM01/adump'' comment=
'''' scope=spfile";
sql clone "alter system set db_create_file_dest =
''/media/oracle/oradata/DREAM01/'' comment=
'''' scope=spfile";
sql clone "alter system set dispatchers =
''(PROTOCOL=TCP) (SERVICE=DREAM01XDB)'' comment=
'''' scope=spfile";
sql clone "alter system set db_unique_name =
''DREAM01'' comment=
'''' scope=spfile";
sql clone "alter system set db_file_name_convert =
''/DREAM/'', ''/DREAM01/'' comment=
'''' scope=spfile";
sql clone "alter system set log_file_name_convert =
''/DREAM/'', ''/DREAM01/'' comment=
'''' scope=spfile";
sql clone "alter system set control_files =
''/media/oracle/oradata/DREAM01/control01.ctl'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_max_processes =
5 comment=
'''' scope=spfile";
sql clone "alter system set fal_client =
''boston'' comment=
'''' scope=spfile";
sql clone "alter system set fal_server =
''chicago'' comment=
'''' scope=spfile";
sql clone "alter system set standby_file_management =
''AUTO'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_config =
''dg_config=(dream,dream01)'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
''LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=DREAM01'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_2 =
''service=dream ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=DREAM'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script

sql statement: alter system set audit_file_dest = ''/media/oracle/admin/DREAM01/adump'' comment= '''' scope=spfile

sql statement: alter system set db_create_file_dest = ''/media/oracle/oradata/DREAM01/'' comment= '''' scope=spfile

sql statement: alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=DREAM01XDB)'' comment= '''' scope=spfile

sql statement: alter system set db_unique_name = ''DREAM01'' comment= '''' scope=spfile

sql statement: alter system set db_file_name_convert = ''/DREAM/'', ''/DREAM01/'' comment= '''' scope=spfile

sql statement: alter system set log_file_name_convert = ''/DREAM/'', ''/DREAM01/'' comment= '''' scope=spfile

sql statement: alter system set control_files = ''/media/oracle/oradata/DREAM01/control01.ctl'' comment= '''' scope=spfile

sql statement: alter system set log_archive_max_processes = 5 comment= '''' scope=spfile

sql statement: alter system set fal_client = ''DREAM01'' comment= '''' scope=spfile

sql statement: alter system set fal_server = ''DREAM'' comment= '''' scope=spfile

sql statement: alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile

sql statement: alter system set log_archive_config = ''dg_config=(dream,dream01)'' comment= '''' scope=spfile

sql statement: alter system set log_archive_dest_1 = ''LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=DREAM01'' comment= '''' scope=spfile

sql statement: alter system set log_archive_dest_2 = ''service=dream ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=DREAM'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 534462464 bytes

Fixed Size 2228200 bytes
Variable Size 335544344 bytes
Database Buffers 188743680 bytes
Redo Buffers 7946240 bytes

contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '/media/oracle/oradata/DREAM01/control01.ctl';
}
executing Memory Script

Starting backup at 05-JUN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_dream.f tag=TAG20120605T174549 RECID=18 STAMP=785180750
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 05-JUN-12

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 newname for tempfile 1 to
"/media/oracle/oradata/DREAM01/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/media/oracle/oradata/DREAM01/system01.dbf";
set newname for datafile 2 to
"/media/oracle/oradata/DREAM01/sysaux01.dbf";
set newname for datafile 3 to
"/media/oracle/oradata/DREAM01/undotbs01.dbf";
set newname for datafile 4 to
"/media/oracle/oradata/DREAM01/users01.dbf";
set newname for datafile 5 to
"/media/oracle/oradata/DREAM01/indexes01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/media/oracle/oradata/DREAM01/system01.dbf" datafile
2 auxiliary format
"/media/oracle/oradata/DREAM01/sysaux01.dbf" datafile
3 auxiliary format
"/media/oracle/oradata/DREAM01/undotbs01.dbf" datafile
4 auxiliary format
"/media/oracle/oradata/DREAM01/users01.dbf" datafile
5 auxiliary format
"/media/oracle/oradata/DREAM01/indexes01.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /media/oracle/oradata/DREAM01/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 05-JUN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/media/oracle/oradata/DREAM/sysaux01.dbf
output file name=/media/oracle/oradata/DREAM01/sysaux01.dbf tag=TAG20120605T174557
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/media/oracle/oradata/DREAM/system01.dbf
output file name=/media/oracle/oradata/DREAM01/system01.dbf tag=TAG20120605T174557
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/media/oracle/oradata/DREAM/undotbs01.dbf
output file name=/media/oracle/oradata/DREAM01/undotbs01.dbf tag=TAG20120605T174557
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/media/oracle/oradata/DREAM/users01.dbf
output file name=/media/oracle/oradata/DREAM01/users01.dbf tag=TAG20120605T174557
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/media/oracle/oradata/DREAM/indexes01.dbf
output file name=/media/oracle/oradata/DREAM01/indexes01.dbf tag=TAG20120605T174557
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 05-JUN-12

sql statement: alter system archive log current

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=18 STAMP=785180817 file name=/media/oracle/oradata/DREAM01/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=19 STAMP=785180817 file name=/media/oracle/oradata/DREAM01/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=20 STAMP=785180817 file name=/media/oracle/oradata/DREAM01/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=21 STAMP=785180817 file name=/media/oracle/oradata/DREAM01/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=22 STAMP=785180817 file name=/media/oracle/oradata/DREAM01/indexes01.dbf
Finished Duplicate Db at 05-JUN-12

RMAN>

 

oracle@admtps-Sun-Fire-X4150:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin$ sqlplus sys/libin@dream01 as sysdba;

SQL*Plus: Release 11.2.0.2.0 Production on Tue Jun 5 17:48:42 2012

Copyright (c) 1982, 2010, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

SQL> alter system set fal_client='DREAM01';

System altered.

SQL> alter system set fal_server='DREAM';

System altered.

SQL> select open_mode,database_role from v$database;

OPEN_MODE DATABASE_ROLE
-------------------- ----------------
MOUNTED PHYSICAL STANDBY

SQL> alter database recover managed standby database disconnect from session;

Database altered.


SQL> select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED

SQL> alter database recover managed standby database cancel;

Database altered.


SQL> alter database open read only;

Database altered.


SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY


SQL> alter database recover managed standby database disconnect from session;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY WITH APPLY

SQL>

 

分享到:
评论

相关推荐

    Oracle 11gR2 使用 RMAN duplicate from active database 复制数据库

    Oracle 11gR2 使用 RMAN duplicate from active database 复制数据库 Oracle 11gR2 中使用 RMAN duplicate from active database 复制数据库是一种高效的数据库复制方法。这种方法可以直接从活动数据库复制,省去...

    使用RMAN DUPLICATE...FROM ACTIVE DATABASE 创建物理备库.docx

    【使用RMAN DUPLICATE...FROM ACTIVE DATABASE 创建物理备库】 在Oracle数据库管理中,创建物理备用数据库(Physical Standby Database)是数据保护策略的重要组成部分,主要用于实现Data Guard环境中的灾难恢复和...

    Oracle Rman Active Database Duplicate 迁移方案V1.1.pdf

    本文档主要介绍 Oracle Rman Active Database Duplicate 迁移方案,适用于 Oracle 11g/12c 版本。该方案旨在帮助数据库管理员快速迁移数据库,减少迁移时间和风险。 第 1 章概述 ================ 本文档将介绍 ...

    大牛教你配置Oracle 11g Active Dataguard

    Oracle 11g Active Data Guard 是Oracle数据库系统中一种高级的数据保护和灾难恢复技术,它在主数据库运行的同时,创建并维护一个或多个只读的物理 standby 数据库。Active Data Guard 提供了实时的数据保护,使得在...

    Oracle 11g RAC-RAC DG Duplicate搭建(生产操作文档).docx

    Oracle 11g RAC (Real Application Clusters) 和 Data Guard 是两个重要的数据库技术,用于构建高可用性和灾难恢复解决方案。在这个生产操作文档中,主要讲述了如何在Oracle 11g环境中搭建RAC到RAC的Data Guard复制...

    oracle 11g rac to one standby database

    Oracle数据库11g是一个企业级关系型数据库管理系统,它支持高度的数据可用性和大规模数据量的管理。在本文中,我们将讨论如何将Oracle 11g RAC(Real Application Clusters)环境搭建为单实例的物理备库。这是一个...

    Oracle Data Guard单实例TO单实例迁移方案(基于active duplicate)V1.1 .pdf

    本迁移方案专注于将一个Oracle Data Guard单实例环境迁移到另一个单实例环境,基于active duplicate技术,适用于Oracle 11g和12c版本。文档详细描述了整个迁移过程,包括Data Guard的技术原理、兼容性以及实施迁移所...

    12c Data Guard配置手册-01

    12c Data Guard配置手册主要围绕Oracle Database 12c Release **.*.*.*.0版本展开,涉及Data Guard的快速部署方法,以及使用RMAN(Recovery Manager)实现数据文件同步等关键技术操作。本文将基于提供的内容部分详细...

    Windows+Server+2008环境下的配置Oracle+11gR2+Data+Guard配置过程

    在Windows Server 2008环境下配置Oracle 11g Release 2 (11gR2) Data Guard是一项复杂但至关重要的任务,旨在确保数据库的高可用性和灾难恢复能力。以下是一个详细的步骤指南: 1. **系统准备**: - 安装Windows ...

    ORACLE Duplicate复制数据库

    RMAN> DUPLICATE TARGET DATABASE TO TESTA FROM ACTIVE DATABASE; ``` #### 注意事项 - 确保目标数据库和辅助数据库的文件路径一致或通过相应的转换参数进行调整。 - 在执行RMAN备份时,需要确保有足够的磁盘...

    linux下oracle 11g R2 dataguard

    在Linux环境下,Oracle 11g R2 Data Guard是一种高可用性和灾难恢复解决方案,它通过在不同的物理或逻辑位置维护一个或多个备用数据库,来保护关键业务数据免受硬件故障、自然灾害或其他潜在的数据丢失风险。...

    Oracle 11gR2 使用copy 数据文件搭建物理 Data Guard

    Oracle 11gR2 版本中的物理 Data Guard 是一种高可用性和灾难恢复解决方案,它通过在主数据库和备用数据库之间同步数据来确保数据的安全性。Data Guard 提供了多种保护模式,包括最大保护、最大性能和最大可用性,以...

    Oracle 12c 部署Data Guard,Switchover和Failover

    在Oracle Database 12c版本中,Data Guard进行了重大更新,引入了Active Data Guard(ADG)和Logical Data Guard(LDG)等新特性,为数据库的高可用性和灾难恢复提供了更加灵活和强大的支持。 部署Data Guard涉及的...

    Oracle 11.2.0.3 RAC 与 RAC 之间搭建Data Guard 案例

    Aactive Data Guard的运用进一步提高了系统的利用率,使得备用数据库在保护生产环境的同时,也能承担一部分非事务处理任务。理解并熟练掌握这种配置,对维护大型Oracle数据库系统的稳定性至关重要。

    Oracle 11gR2 使用RMAN 复制搭建物理Data Guard

    Oracle 11gR2 版本中的物理Data Guard是一种高度可用性和灾难恢复解决方案,它通过在多个数据库之间保持实时或近实时的数据同步来保护关键数据。RMAN(恢复管理器)是Oracle数据库的一个内置工具,用于备份、恢复...

    oracle 11g dataguard步骤

    根据提供的文件信息,以下是对Oracle 11g Data Guard配置步骤的详细解析: ### 1. 判断DataGuard是否已安装 首先确认Oracle环境是否支持Data Guard功能。可以通过查询`v$option`视图来检查Oracle Data Guard是否...

    Oracle11G DataGuard相同SID物理Standby搭建手册

    Oracle 11g DataGuard是Oracle数据库系统中的一个强大特性,用于实现高可用性和灾难恢复。DataGuard通过创建和维护一个或多个备用数据库,确保在主数据库出现问题时,业务能够迅速切换到备用数据库,减少数据丢失和...

    redhat5.4 Oracle 10G Data Guard 配置

    ### Redhat5.4 Oracle 10G Data Guard 配置 #### 概念介绍 **DataGuard** 是 Oracle 提供的一种高级数据保护技术,它主要用于实现数据的高可用性和灾难恢复。通过构建一个或多个备用数据库(Standby Database),...

    Oracle 11gR2 dataguard搭建说明 --- duplicate方式.txt

    Oracle 11gR2 dataguard搭建说明

    DATA GUARD安装

    "RMAN使用DUPLICATE搭建DATA GUARD"文件则会进一步阐述如何利用`DUPLICATE`命令的选项,例如`FROM ACTIVE DATABASE`,来直接从运行中的主数据库复制数据,而无需停机。这在保持业务连续性的同时,也能快速设置备用...

Global site tag (gtag.js) - Google Analytics