Sie sind auf Seite 1von 6

== Get the current database file locations == Datafiles SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------/u01/app/oracle/oradata/prod/system01.dbf /u01/app/oracle/oradata/prod/sysaux01.

dbf /u01/app/oracle/oradata/prod/undotbs01.dbf /u01/app/oracle/oradata/prod/users01.dbf /u01/app/oracle/oradata/prod/example01.dbf /u01/app/oracle/oradata/prod/rman01.dbf 6 rows selected. == Controlfiles SQL> select name from v$controlfile; NAME -------------------------------------------------------------------------------/u01/app/oracle/oradata/prod/control01.ctl /u01/app/oracle/fast_recovery_area/prod/control02.ctl

=== Redo logfiles SQL> select member from v$logfile; MEMBER -------------------------------------------------------------------------------/u01/app/oracle/oradata/prod/redo03.log /u01/app/oracle/oradata/prod/redo02.log /u01/app/oracle/oradata/prod/redo01.log

Start the database with spfile ================================================== SQL> startup ORACLE instance started. Total System Global Area 521936896 bytes Fixed Size 2290264 bytes Variable Size 264244648 bytes Database Buffers 251658240 bytes Redo Buffers 3743744 bytes SQL> exit sql>alter system set control_files='+DATA_GROUP1' scope=spfile; sql>ALTER SYSTEM SET db_create_file_dest='+DATA_GROUP1' scope=spfile; sql>ALTER SYSTEM SET db_recovery_file_dest='+DATA_GROUP1' scope=spfile; Startup the target database in NOMOUNT mode SQL> startup nomount; ORACLE instance started. Total System Global Area 521936896 bytes

Fixed Size 2290264 bytes Variable Size 264244648 bytes Database Buffers 251658240 bytes Redo Buffers 3743744 bytes SQL> exit

4. From an RMAN session, copy one of your controlfiles from the local file system to its new location in ASM. The new controlfile will be copied to the value specified in the initialization parameter control_files

[oracle@linux6 dbs]$ rman target / Recovery Manager: Release 12.1.0.1.0 - Production on Tue Feb 25 16:11:38 2014 Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved. connected to target database: PROD (not mounted)

RMAN> RESTORE CONTROLFILE FROM '/u01/app/oracle/oradata/prod/control01.ctl'; Starting restore at 25-FEB-14 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=25 device type=DISK channel ORA_DISK_1: copied control file copy output file name=+DATA/PROD/CONTROLFILE/current.257.840471181 Finished restore at 25-FEB-14

5. From an RMAN or SQL*Plus session, mount the database. This will mount the database using the controlfile stored in ASM RMAN> ALTER DATABASE MOUNT; database mounted released channel: ORA_DISK_1

6. From an RMAN session, copy the database files from the local file system to ASM AN> BACKUP AS COPY DATABASE FORMAT '+DATA_GROUP1'; Starting backup at 25-FEB-14 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=25 device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00001 name=/u01/oradata/prod/system01.dbf 7. From an RMAN session, update the control file / data dictionary so that all database files point to the RMAN copy made in ASM RMAN> SWITCH DATABASE TO COPY;

Recovery Manager complete. [oracle@linux6 dbs]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Tue Feb 25 16:20:29 2014 Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL; ORA-00279: change 1903837 generated at 02/25/2014 16:10:06 needed for thread 1 ORA-00289: suggestion : +DATA ORA-15173: entry 'ARCHIVELOG' does not exist in directory 'PROD' ORA-00280: change 1903837 for thread 1 is in sequence #17

Specify log: {<RET>=suggested | filename | AUTO | CANCEL} cancel Media recovery cancelled. SQL> alter database open resetlogs; SQL> select name,status from v$database,v$instance; NAME STATUS --------- -----------PROD OPEN

9. From a SQL*Plus session, re-create any tempfiles that are still currently on the local file system to ASM. This is done by simply dropping the tempfiles from the local file system and re-creating them in ASM as below. SQL> select tablespace_name, file_name, bytes from dba_temp_files; TABLESPACE_NAME -----------------------------FILE_NAME -------------------------------------------------------------------------------BYTES ---------TEMP /oradata_01/MYASMDB/temp01.dbf 67108864

SQL> alter database tempfile '/u01/app/oracle/oradata/prod/temp01.dbf' drop including datafiles; Database altered. SQL> alter tablespace temp add tempfile size 512m; Tablespace altered.

SQL> select tablespace_name, file_name, bytes from dba_temp_files; TABLESPACE_NAME -----------------------------FILE_NAME -------------------------------------------------------------------------------BYTES ---------TEMP +DATA/MYASMDB/tempfile/temp.512.769239527 536870912

10. From a SQL*Plus session, re-create any online redo logfiles that are still currently on the local file system to ASM. This is done by simply dropping the logfiles from the local file system and re-creating them in ASM as below. Note : While dropping redolog group, make sure that it is not current redolog group. If you do so, you will get error as SQL> ALTER DATABASE DROP LOGFILE GROUP 1; ALTER DATABASE DROP LOGFILE GROUP 1

SQL> alter system switch logfile; SQL> select group#, status from v$log; GROUP# STATUS ---------- ---------------1 CURRENT 2 INACTIVE 3 INACTIVE SQL> alter database drop logfile group 1; Database altered. SQL> alter database add logfile group 1 size 100m; Database altered. SQL> select group#, status from v$log; GROUP# STATUS ---------- ---------------1 UNUSED 2 INACTIVE 3 CURRENT SQL> alter database drop logfile group 2; Database altered. SQL> alter database add logfile group 2 size 100m;

Database altered. 11. Verify that all online redo logfiles have been created in ASM SQL> select a.group#, a.member, b.bytes from v$logfile a, v$log b where a.group# = b.group#;

12. Perform the below steps to relocate the SPFILE from the local file system to an ASM disk group. 2. Perform the below steps to relocate the SPFILE from the local file system to an ASM disk group. SQL> create pfile from spfile; File created. SQL> CREATE SPFILE='+DATA_GROUP1/PROD/spfilePROD.ora' from pfile; File created.

13. Verify that all database files have been created in ASM SQL> SQL> SELECT 2 d.tablespace_name tablespace 3 , d.file_name filename 4 , d.bytes filesize 5 , d.autoextensible autoextensible 6 , d.increment_by * e.value increment_by 7 , d.maxbytes maxbytes 8 FROM 9 sys.dba_data_files d 10 , v$datafile v 11 , (SELECT value 12 FROM v$parameter 13 WHERE name = 'db_block_size') e 14 WHERE 15 (d.file_name = v.name) UNION 16 17 SELECT 18 d.tablespace_name tablespace 19 , d.file_name filename , d.bytes filesize 20 21 , d.autoextensible autoextensible 22 , d.increment_by * e.value increment_by 23 , d.maxbytes maxbytes 24 FROM 25 sys.dba_temp_files d 26 , (SELECT value 27 FROM v$parameter 28 WHERE name = 'db_block_size') e 29 UNION 30 SELECT 31 '[ ONLINE REDO LOG ]' 32 , a.member

33 , b.bytes 34 , null 35 , TO_NUMBER(null) 36 , TO_NUMBER(null) 37 FROM 38 v$logfile a 39 , v$log b 40 WHERE 41 a.group# = b.group# 42 UNION SELECT 43 44 '[ CONTROL FILE 45 , a.name 46 , TO_NUMBER(null) 47 , null 48 , TO_NUMBER(null) 49 , TO_NUMBER(null) 50 FROM 51 v$controlfile a 52 ORDER BY 1,2 /

]'

Das könnte Ihnen auch gefallen