четверг, 7 октября 2010 г.

ASM Duplicate Controlfiles

$ export ORACLE_SID=testasm
$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Thu Sep 16 15:58:23 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA/testasm/controlfile/current.256.729705169

SQL>



$ export ORACLE_SID=+ASM
$ asmcmd
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 254867 253505 0 253505 0 N DATA/
MOUNTED EXTERN N 512 4096 1048576 284667 284496 0 284496 0 N FRA/
MOUNTED EXTERN N 512 4096 1048576 30719 30354 0 30354 0 N REDO/
ASMCMD> cd +
ASMCMD> pwd
+
ASMCMD> find --type controlfile . *
+DATA/TESTASM/CONTROLFILE/Current.256.729705169
ASMCMD> exit
$


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 897581056 bytes
Fixed Size 2088056 bytes
Variable Size 230687624 bytes
Database Buffers 658505728 bytes
Redo Buffers 6299648 bytes
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


$ rman nocatalog

Recovery Manager: Release 10.2.0.4.0 - Production on Thu Sep 16 16:13:29 2010

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

RMAN> connect target;

connected to target database: testasm (not mounted)
using target database control file instead of recovery catalog

RMAN> restore controlfile to '+FRA' from '+DATA/testasm/controlfile/current.256.729705169';

Starting restore at 16-SEP-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 16-SEP-10

RMAN> restore controlfile to '+REDO' from '+DATA/testasm/controlfile/current.256.729705169';

Starting restore at 16-SEP-10
using channel ORA_DISK_1

channel ORA_DISK_1: copied control file copy
Finished restore at 16-SEP-10

RMAN> exit


Recovery Manager complete.
$


$ asmcmd
ASMCMD> find --type controlfile . *
+DATA/TESTASM/CONTROLFILE/Current.256.729705169
+FRA/TESTASM/CONTROLFILE/current.261.729880549
+REDO/TESTASM/CONTROLFILE/current.260.729880559
ASMCMD> exit
$


$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Thu Sep 16 16:36:17 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter system set control_files=
2 '+DATA/TESTASM/CONTROLFILE/Current.256.729705169',
3 '+FRA/TESTASM/CONTROLFILE/current.261.729880549',
4 '+REDO/TESTASM/CONTROLFILE/current.260.729880559'
5 scope=spfile;


System altered.

SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 897581056 bytes
Fixed Size 2088056 bytes
Variable Size 230687624 bytes
Database Buffers 658505728 bytes
Redo Buffers 6299648 bytes
Database mounted.
Database opened.
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA/testasm/controlfile/current.256.729705169
+FRA/testasm/controlfile/current.261.729880549
+REDO/testasm/controlfile/current.260.729880559

SQL>