Search This Blog

Total Pageviews

Sunday, 2 July 2017

Oracle Database from File system to +ASM Migration ..

Oracle Database from File system to +ASM Migration ..

File system to +ASM


For this demonstration I am Creating new database 

Create database . 

create database vihd
logfile   group 1 ('/u01/app/oracle/oradata/vihd/redo1.log') size 10M,
          group 2 ('/u01/app/oracle/oradata/vihd/redo2.log') size 10M,
          group 3 ('/u01/app/oracle/oradata/vihd/redo3.log') size 10M
CHARACTER         SET WE8ISO8859P1
NATIONAL CHARACTER SET AL16UTF16
datafile '/u01/app/oracle/oradata/vihd/system.dbf' size 50M  autoextend on  next 10M  extent management local
sysaux datafile '/u01/app/oracle/oradata/vihd/sysaux.dbf'                            size 10M  autoextend on   next 10M 
undo tablespace UNDOTBS1  datafile '/u01/app/oracle/oradata/vihd/undo.dbf'           size 10M  autoextend on
default temporary tablespace temp  tempfile '/u01/app/oracle/oradata/vihd/temp.dbf'  size 10M  autoextend on;


SQL> SQL> create database vihd
  2    logfile   group 1 ('/u01/app/oracle/oradata/vihd/redo1.log') size 10M,
  3              group 2 ('/u01/app/oracle/oradata/vihd/redo2.log') size 10M,
  4              group 3 ('/u01/app/oracle/oradata/vihd/redo3.log') size 10M
  5   CHARACTER SET WE8ISO8859P1
  6  NATIONAL CHARACTER SET AL16UTF16
  7     datafile '/u01/app/oracle/oradata/vihd/system.dbf' size 50M  autoextend on  next 10M  extent management local
  8    sysaux datafile '/u01/app/oracle/oradata/vihd/sysaux.dbf' size 10M  autoextend on   next 10M
  undo tablespace UNDOTBS1  datafile '/u01/app/oracle/oradata/vihd/undo.dbf' size 10M  autoextend on
  9   10    default temporary tablespace temp  tempfile '/u01/app/oracle/oradata/vihd/temp.dbf'  size 10M  autoextend on;

Database created.


SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp



Check file location ..

http://anuj-singh.blogspot.co.uk/2016/12/oracle-datafile-info.html
______________________________________________________________________________________________________________________

                                                                                          01 Jul 2017 17:31:28
                                                                                    File Report (all physical files)
                                                                    Data File Report (all physical files) oraasm12c.localdomain-VIHD
______________________________________________________________________________________________________________________

Tablespace Name / File Class   Filename                                                                          File Size MB Auto             Next           Max MB
------------------------------ --------------------------------------------------------------------------- ------------------ ---- ---------------- ----------------
SYSAUX                         /u01/app/oracle/oradata/vihd/sysaux.dbf                                                     80 YES                10           32,768
SYSTEM                         /u01/app/oracle/oradata/vihd/system.dbf                                                    260 YES                10           32,768
TEMP                           /u01/app/oracle/oradata/vihd/temp.dbf                                                       10 YES                 0           32,768
UNDOTBS1                       /u01/app/oracle/oradata/vihd/undo.dbf                                                      191 YES                 0           32,768
[ BLOCK TRACKING]DISABLED
[ CONTROL FILE    ]            /u01/app/oracle/oradata/vihd/ora_control1                                                    8
[ CONTROL FILE    ]            /u01/app/oracle/oradata/vihd/ora_control2                                                    8
[ ONLINE REDO LOG ]            /u01/app/oracle/oradata/vihd/redo1.log                                                      10                                     10
[ ONLINE REDO LOG ]            /u01/app/oracle/oradata/vihd/redo2.log                                                      10                                     10
[ ONLINE REDO LOG ]            /u01/app/oracle/oradata/vihd/redo3.log                                                      10                                     10
[ Spfile or Pfile]PFILE

11 rows selected.


Take Rman backup in case .. 

/u01/app/oracle/RmanBackup

RUN
{ configure controlfile autobackup on;
set command id to 'VIHDBackupFull';
ALLOCATE CHANNEL c1 DEVICE TYPE disk;
backup AS COMPRESSED BACKUPSET full database tag ORCLEE_FULL format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_FULL' ;
sql 'alter system archive log current';
backup tag ORCLEE_ARCHIVE format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_ARCHIVE' archivelog all delete all input ;
backup spfile format '/u01/app/oracle/RmanBackup/spfile_%d_%s_%T_dbid%I'; 
backup tag ORCLEE_CONTROL current controlfile format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_CONTROL';
release channel c1;
}



RMAN> 2> { configure controlfile autobackup on;
3> set command id to 'VIHDBackupFull';
4> ALLOCATE CHANNEL c1 DEVICE TYPE disk;
5> backup AS COMPRESSED BACKUPSET full database tag ORCLEE_FULL format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_FULL' ;
sql 'alter system archive log current';
backup tag ORCLEE_ARCHIVE format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_ARCHIVE' archivelog all delete all input ;
backup spfile format '/u01/app/oracle/RmanBackup/spfile_%d_%s_%T_dbid%I';
backup tag ORCLEE_CONTROL current controlfile format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_CONTROL';
release channel c1;
6> 7> 8> 9> 10> 11> }

using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

executing command: SET COMMAND ID

allocated channel: c1
channel c1: SID=31 device type=DISK

Starting backup at 01-JUL-17
channel c1: starting compressed full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/vihd/system.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/vihd/undo.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/vihd/sysaux.dbf
channel c1: starting piece 1 at 01-JUL-17
channel c1: finished piece 1 at 01-JUL-17
piece handle=/u01/app/oracle/RmanBackup/VIHD_20170701_1_1_FULL tag=ORCLEE_FULL comment=NONE
channel c1: backup set complete, elapsed time: 00:00:26
Finished backup at 01-JUL-17

Starting Control File and SPFILE Autobackup at 01-JUL-17
piece handle=/u01/app/oracle/product/11.2.0.4/db_1/dbs/c-646516965-20170701-00 comment=NONE
Finished Control File and SPFILE Autobackup at 01-JUL-17

sql statement: alter system archive log current

Starting backup at 01-JUL-17
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=62 RECID=1 STAMP=948217415
input archived log thread=1 sequence=63 RECID=2 STAMP=948217415
channel c1: starting piece 1 at 01-JUL-17
channel c1: finished piece 1 at 01-JUL-17
piece handle=/u01/app/oracle/RmanBackup/VIHD_20170701_3_1_ARCHIVE tag=ORCLEE_ARCHIVE comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/u01/app/oracle/ArchiveVIHD/1_62_948216037.dbf RECID=1 STAMP=948217415
archived log file name=/u01/app/oracle/ArchiveVIHD/1_63_948216037.dbf RECID=2 STAMP=948217415
Finished backup at 01-JUL-17

Starting backup at 01-JUL-17
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel c1: starting piece 1 at 01-JUL-17
channel c1: finished piece 1 at 01-JUL-17
piece handle=/u01/app/oracle/RmanBackup/spfile_VIHD_4_20170701_dbid646516965 tag=TAG20170701T174336 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 01-JUL-17

Starting backup at 01-JUL-17
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 01-JUL-17
channel c1: finished piece 1 at 01-JUL-17
piece handle=/u01/app/oracle/RmanBackup/VIHD_20170701_5_1_CONTROL tag=ORCLEE_CONTROL comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 01-JUL-17

Starting Control File and SPFILE Autobackup at 01-JUL-17
piece handle=/u01/app/oracle/product/11.2.0.4/db_1/dbs/c-646516965-20170701-01 comment=NONE
Finished Control File and SPFILE Autobackup at 01-JUL-17

released channel: c1

===========

su - grid 

Check asm Group 
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     40954    33872                0           33872              0             N  DATA/


Set following parameter for database .. 

su - oracle 

SQL>ALTER SYSTEM SET control_files='+DATA' scope=spfile;

SQL>ALTER SYSTEM SET db_create_file_dest='+DATA' SCOPE=spfile;



Migration Start from here **************************


[oracle@oraasm12c dbs]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jul 1 17:52:57 2017

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

connected to target database: VIHD (DBID=646516965)

RMAN> backup as copy database format '+DATA';

Starting backup at 01-JUL-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=31 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/vihd/system.dbf
output file name=+DATA/vihd/datafile/system.293.948217989 tag=TAG20170701T175305 RECID=1 STAMP=948218005
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=/u01/app/oracle/oradata/vihd/undo.dbf
output file name=+DATA/vihd/datafile/undotbs1.294.948218011 tag=TAG20170701T175305 RECID=2 STAMP=948218021
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/vihd/sysaux.dbf
output file name=+DATA/vihd/datafile/sysaux.295.948218027 tag=TAG20170701T175305 RECID=3 STAMP=948218030
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 01-JUL-17

Starting Control File and SPFILE Autobackup at 01-JUL-17
piece handle=/u01/app/oracle/product/11.2.0.4/db_1/dbs/c-646516965-20170701-02 comment=NONE
Finished Control File and SPFILE Autobackup at 01-JUL-17



RMAN> shutdown immediate

database closed
database dismounted
Oracle instance shut down

RMAN> startup nomount

connected to target database (not started)
Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2260088 bytes
Variable Size                671089544 bytes
Database Buffers             390070272 bytes
Redo Buffers                   5517312 bytes


restore controlfile from '/u01/app/oracle/oradata/vihd/ora_control1';

RMAN> restore controlfile from '/u01/app/oracle/oradata/vihd/ora_control1';

Starting restore at 01-JUL-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=+DATA/vihd/controlfile/current.296.948218153
Finished restore at 01-JUL-17


RMAN> sql 'alter database mount';

sql statement: alter database mount
released channel: ORA_DISK_1


RMAN> switch database to copy;

datafile 1 switched to datafile copy "+DATA/vihd/datafile/system.293.948217989"
datafile 2 switched to datafile copy "+DATA/vihd/datafile/sysaux.295.948218027"
datafile 3 switched to datafile copy "+DATA/vihd/datafile/undotbs1.294.948218011"

RMAN> recover database;

Starting recover at 01-JUL-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:01

Finished recover at 01-JUL-17

RMAN> sql 'alter database open';

sql statement: alter database open



_____________________________________________________________________________________________________________________

                                                                                          01 Jul 2017 17:58:06
                                                                                    File Report (all physical files)
                                                                    Data File Report (all physical files) oraasm12c.localdomain-VIHD
______________________________________________________________________________________________________________________

Tablespace Name / File Class   Filename                                                                          File Size MB Auto             Next           Max MB
------------------------------ --------------------------------------------------------------------------- ------------------ ---- ---------------- ----------------
SYSAUX                         +DATA/vihd/datafile/sysaux.295.948218027                                                    80 YES                10           32,768
SYSTEM                         +DATA/vihd/datafile/system.293.948217989                                                   260 YES                10           32,768
TEMP                           /u01/app/oracle/oradata/vihd/temp.dbf                                                       10 YES                 0           32,768
UNDOTBS1                       +DATA/vihd/datafile/undotbs1.294.948218011                                                 193 YES                 0           32,768
[ BLOCK TRACKING]DISABLED
[ CONTROL FILE    ]            +DATA/vihd/controlfile/current.296.948218153                                                 8
[ ONLINE REDO LOG ]            /u01/app/oracle/oradata/vihd/redo1.log                                                      10                                     10
[ ONLINE REDO LOG ]            /u01/app/oracle/oradata/vihd/redo2.log                                                      10                                     10
[ ONLINE REDO LOG ]            /u01/app/oracle/oradata/vihd/redo3.log                                                      10                                     10
[ Spfile or Pfile]SPFILE       /u01/app/oracle/product/11.2.0.4/db_1/dbs/spfilevihd.ora

10 rows selected.



SQL>  select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/vihd/redo1.log
/u01/app/oracle/oradata/vihd/redo2.log
/u01/app/oracle/oradata/vihd/redo3.log


for redo logfile ..

alter system set db_create_online_log_dest_1='+DATA' scope=spfile;



SQL>  select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/vihd/redo1.log
/u01/app/oracle/oradata/vihd/redo2.log
/u01/app/oracle/oradata/vihd/redo3.log

SQL> alter system set db_create_online_log_dest_1='+DATA' scope=spfile;

System altered.

SQL> alter database add logfile group 4;

Database altered.

SQL>  select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/vihd/redo1.log
/u01/app/oracle/oradata/vihd/redo2.log
/u01/app/oracle/oradata/vihd/redo3.log
+DATA/vihd/onlinelog/group_4.297.948218545

SQL> alter database add logfile group 5;

Database altered.

SQL>  alter database add logfile group 6;

Database altered.

SQL> alter database drop logfile group 2;

Database altered.

SQL> alter database drop logfile group 3;

Database altered.

SQL> alter system switch logfile;

System altered.

SQL> alter system checkpoint;

System altered.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/vihd/redo1.log
+DATA/vihd/onlinelog/group_4.297.948218545
+DATA/vihd/onlinelog/group_5.298.948218591
+DATA/vihd/onlinelog/group_6.299.948218599


SQL> alter database drop logfile group 1;

Database altered.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
+DATA/vihd/onlinelog/group_4.297.948218545
+DATA/vihd/onlinelog/group_5.298.948218591
+DATA/vihd/onlinelog/group_6.299.948218599



Now the entire database got migrated to ASM storage and opened the database WITHOUT RESETLOGS!!

SQL> CREATE TEMPORARY TABLESPACE TEMP2 tempfile '+DATA' size 256M;

Tablespace created.

SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP2;

Database altered.


SQL> DROP TABLESPACE TEMP INCLUDING CONTENTS AND DATAFILES;

Tablespace dropped.

if required ..

CREATE TEMPORARY TABLESPACE TEMP TEMPFILE '+DATA' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL UNIFORM SIZE 10M 
SEGMENT SPACE MANAGEMENT MANUAL
/



______________________________________________________________________________________________________________________

                                                                                          01 Jul 2017 18:10:17
                                                                                    File Report (all physical files)
                                                                    Data File Report (all physical files) oraasm12c.localdomain-VIHD
______________________________________________________________________________________________________________________

Tablespace Name / File Class   Filename                                                                          File Size MB Auto             Next           Max MB
------------------------------ --------------------------------------------------------------------------- ------------------ ---- ---------------- ----------------
SYSAUX                         +DATA/vihd/datafile/sysaux.295.948218027                                                    80 YES                10           32,768
SYSTEM                         +DATA/vihd/datafile/system.293.948217989                                                   260 YES                10           32,768
TEMP2                          +DATA/vihd/tempfile/temp2.300.948218907                                                    256 NO                  0                0
UNDOTBS1                       +DATA/vihd/datafile/undotbs1.294.948218011                                                 193 YES                 0           32,768
[ BLOCK TRACKING]DISABLED
[ CONTROL FILE    ]            +DATA/vihd/controlfile/current.296.948218153                                                 8
[ ONLINE REDO LOG ]            +DATA/vihd/onlinelog/group_4.297.948218545                                                 100                                    100
[ ONLINE REDO LOG ]            +DATA/vihd/onlinelog/group_5.298.948218591                                                 100                                    100
[ ONLINE REDO LOG ]            +DATA/vihd/onlinelog/group_6.299.948218599                                                 100                                    100
[ Spfile or Pfile]SPFILE       /u01/app/oracle/product/11.2.0.4/db_1/dbs/spfilevihd.ora

10 rows selected.



Database  migrated to +ASM without resetlog . 

=======================================================


 If Files are in different mount point .


create database vihd
logfile   group 1 ('/u01/app/oracle/oradata/vihd/redo1.log') size 10M,
          group 2 ('/u01/app/oracle/oradata/vihd/redo2.log') size 10M,
          group 3 ('/u01/app/oracle/oradata/vihd/redo3.log') size 10M
CHARACTER         SET WE8ISO8859P1
NATIONAL CHARACTER SET AL16UTF16
datafile '/u01/app/oracle/oradata/vihd/system.dbf' size 50M  autoextend on  next 10M  extent management local
sysaux datafile '/u01/app/oracle/oradata/vihd2/sysaux.dbf'                            size 10M  autoextend on   next 10M 
undo tablespace UNDOTBS1  datafile '/u01/app/oracle/oradata/vihd/undo.dbf'           size 10M  autoextend on
default temporary tablespace temp  tempfile '/u01/app/oracle/oradata/vihd/temp.dbf'  size 10M  autoextend on;


mkdir -p /u01/app/oracle/oradata/vihd2



SQL> create database vihd
  2  logfile   group 1 ('/u01/app/oracle/oradata/vihd/redo1.log') size 10M,
  3            group 2 ('/u01/app/oracle/oradata/vihd/redo2.log') size 10M,
  4            group 3 ('/u01/app/oracle/oradata/vihd/redo3.log') size 10M
  5  CHARACTER         SET WE8ISO8859P1
  6  NATIONAL CHARACTER SET AL16UTF16
  7  datafile '/u01/app/oracle/oradata/vihd/system.dbf' size 50M  autoextend on  next 10M  extent management local
  8  sysaux datafile '/u01/app/oracle/oradata/vihd2/sysaux.dbf'                            size 10M  autoextend on   next 10M
  9  undo tablespace UNDOTBS1  datafile '/u01/app/oracle/oradata/vihd/undo.dbf'           size 10M  autoextend on
 10  default temporary tablespace temp  tempfile '/u01/app/oracle/oradata/vihd/temp.dbf'  size 10M  autoextend on;

Database created.


SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
SQL>@?/rdbms/admin/utlrp

=================

SQL> show parameter control_files

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      /u01/app/oracle/oradata/vihd/o
                                                 ra_control1, /u01/app/oracle/o
                                                 radata/vihd/ora_control2

SQL> ALTER SYSTEM SET control_files='+DATA' scope=spfile;
ALTER SYSTEM SET control_files='+DATA' scope=spfile
*
ERROR at line 1:
ORA-32001: write to SPFILE requested but no SPFILE is in use


SQL> create spfile from pfile ;

File created.


SQL> show parameter db_create_file_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- -------------------


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u01/app/oracle/product/11.2.0
                                                 .4/db_1/dbs/spfilevihd.ora



SQL> ALTER SYSTEM SET control_files='+DATA' scope=spfile;

System altered.

SQL> ALTER SYSTEM SET db_create_file_dest='+DATA' SCOPE=spfile;

System altered.

http://anuj-singh.blogspot.co.uk/2016/12/oracle-datafile-info.html

Tablespace Name / File Class   Filename                                                                          File Size MB Auto             Next           Max MB
------------------------------ --------------------------------------------------------------------------- ------------------ ---- ---------------- ----------------
SYSAUX                         /u01/app/oracle/oradata/vihd2/sysaux.dbf                                                    80 YES                10           32,768
SYSTEM                         /u01/app/oracle/oradata/vihd/system.dbf                                                    260 YES                10           32,768
TEMP                           /u01/app/oracle/oradata/vihd/temp.dbf                                                       10 YES                 0           32,768
UNDOTBS1                       /u01/app/oracle/oradata/vihd/undo.dbf                                                      193 YES                 0           32,768
[ BLOCK TRACKING]DISABLED
[ CONTROL FILE    ]            /u01/app/oracle/oradata/vihd/ora_control1                                                    8
[ CONTROL FILE    ]            /u01/app/oracle/oradata/vihd/ora_control2                                                    8
[ ONLINE REDO LOG ]            /u01/app/oracle/oradata/vihd/redo1.log                                                      10                                     10
[ ONLINE REDO LOG ]            /u01/app/oracle/oradata/vihd/redo2.log                                                      10                                     10
[ ONLINE REDO LOG ]            /u01/app/oracle/oradata/vihd/redo3.log                                                      10                                     10
[ Spfile or Pfile]SPFILE       /u01/app/oracle/product/11.2.0.4/db_1/dbs/spfilevihd.ora

11 rows selected.



SQL> alter system set log_archive_dest_1='location=/u01/app/oracle/ArchiveVIHD' SCOPE=SPFILE;

System altered.


SQL> startup mount ;
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2260088 bytes
Variable Size             671089544 bytes
Database Buffers          390070272 bytes
Redo Buffers                5517312 bytes
Database mounted.
SQL> alter system set log_archive_dest_1='location=/u01/app/oracle/ArchiveVIHD' SCOPE=SPFILE;

System altered.

SQL> alter database archivelog;

Database altered.

SQL> alter database open ;

Database altered.


SQL> ALTER SYSTEM SET control_files='+DATA' scope=spfile;

System altered.

SQL> ALTER SYSTEM SET db_create_file_dest='+DATA' SCOPE=spfile;

System altered.

SQL> alter system set db_create_online_log_dest_1='+DATA' scope=spfile;

System altered.


[oracle@oraasm12c ArchiveVIHD]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jul 1 20:59:51 2017

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

connected to target database: VIHD (DBID=646528728)

RMAN> backup as copy database format '+DATA';

Starting backup at 01-JUL-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=31 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/vihd/system.dbf
output file name=+DATA/vihd/datafile/system.299.948229219 tag=TAG20170701T210016 RECID=2 STAMP=948229231
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/vihd/undo.dbf
output file name=+DATA/vihd/datafile/undotbs1.298.948229231 tag=TAG20170701T210016 RECID=3 STAMP=948229240
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/vihd2/sysaux.dbf
output file name=+DATA/vihd/datafile/sysaux.297.948229247 tag=TAG20170701T210016 RECID=4 STAMP=948229251
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=+DATA/vihd/controlfile/backup.294.948229253 tag=TAG20170701T210016 RECID=5 STAMP=948229253
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 01-JUL-17
channel ORA_DISK_1: finished piece 1 at 01-JUL-17
piece handle=+DATA/vihd/backupset/2017_07_01/nnsnf0_tag20170701t210016_0.295.948229255 tag=TAG20170701T210016 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 01-JUL-17

RMAN> shutdown immediate ;

database closed
database dismounted
Oracle instance shut down

RMAN> startup nomount

connected to target database (not started)
Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2260088 bytes
Variable Size                671089544 bytes
Database Buffers             390070272 bytes
Redo Buffers                   5517312 bytes

RMAN> restore controlfile from '/u01/app/oracle/oradata/vihd/ora_control1';

Starting restore at 01-JUL-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=+DATA/vihd/controlfile/current.293.948229327
Finished restore at 01-JUL-17

RMAN> sql 'alter database mount';

sql statement: alter database mount
released channel: ORA_DISK_1

RMAN> switch database to copy;

datafile 1 switched to datafile copy "+DATA/vihd/datafile/system.299.948229219"
datafile 2 switched to datafile copy "+DATA/vihd/datafile/sysaux.297.948229247"
datafile 3 switched to datafile copy "+DATA/vihd/datafile/undotbs1.298.948229231"

RMAN>  recover database;

Starting recover at 01-JUL-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 01-JUL-17

RMAN> sql 'alter database open';

sql statement: alter database open

RMAN>


http://anuj-singh.blogspot.co.uk/2012/03/oracle-database-all-file-info.html

Tablespace Name / File Class  Filename                                                               File Size Auto            Next             Max
----------------------------- ---------------------------------------------------------------- --------------- ---- --------------- ---------------
SYSAUX                        +DATA/vihd/datafile/sysaux.297.948229247                              83,886,080 YES       10,485,760  34,359,721,984
SYSTEM                        +DATA/vihd/datafile/system.299.948229219                             272,629,760 YES       10,485,760  34,359,721,984
TEMP                          /u01/app/oracle/oradata/vihd/temp.dbf                                 10,485,760 YES            8,192  34,359,721,984
UNDOTBS1                      +DATA/vihd/datafile/undotbs1.298.948229231                           201,850,880 YES            8,192  34,359,721,984
[ CONTROL FILE ]              +DATA/vihd/controlfile/current.293.948229327
[ ONLINE REDO LOG ]           /u01/app/oracle/oradata/vihd/redo1.log                                10,485,760
[ ONLINE REDO LOG ]           /u01/app/oracle/oradata/vihd/redo2.log                                10,485,760
[ ONLINE REDO LOG ]           /u01/app/oracle/oradata/vihd/redo3.log                                10,485,760
                                                                                               ---------------
sum                                                                                                600,309,760

8 rows selected.




SQL> alter database drop logfile group 2;
alter database drop logfile group 2
*
ERROR at line 1:
ORA-01623: log 2 is current log for instance vihd (thread 1) - cannot drop
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/vihd/redo2.log'


SQL> alter database drop logfile group 1;

Database altered.

SQL> alter database drop logfile group 3;

Database altered.


SQL> alter database drop logfile group 1;

Database altered.

SQL> alter database drop logfile group 3;

Database altered.

SQL> alter system switch logfile;

System altered.

SQL> alter system checkpoint;

System altered.

SQL> alter database drop logfile group 2;

Database altered.


SQL> CREATE TEMPORARY TABLESPACE TEMP1 tempfile '+DATA' size 256M;

Tablespace created.

SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP1;

Database altered.

SQL> DROP TABLESPACE TEMP INCLUDING CONTENTS AND DATAFILES;

Tablespace dropped.

http://anuj-singh.blogspot.co.uk/2016/12/oracle-datafile-info.html

Tablespace Name / File Class   Filename                                                                          File Size MB Auto             Next           Max MB
------------------------------ --------------------------------------------------------------------------- ------------------ ---- ---------------- ----------------
SYSAUX                         +DATA/vihd/datafile/sysaux.297.948229247                                                    80 YES                10           32,768
SYSTEM                         +DATA/vihd/datafile/system.299.948229219                                                   260 YES                10           32,768
TEMP1                          +DATA/vihd/tempfile/temp1.304.948229811                                                    256 NO                  0                0
UNDOTBS1                       +DATA/vihd/datafile/undotbs1.298.948229231                                                 193 YES                 0           32,768
[ BLOCK TRACKING]DISABLED
[ CONTROL FILE    ]            +DATA/vihd/controlfile/current.293.948229327                                                 8
[ ONLINE REDO LOG ]            +DATA/vihd/onlinelog/group_4.301.948229541                                                 100                                    100
[ ONLINE REDO LOG ]            +DATA/vihd/onlinelog/group_5.302.948229547                                                 100                                    100
[ ONLINE REDO LOG ]            +DATA/vihd/onlinelog/group_6.303.948229557                                                 100                                    100
[ Spfile or Pfile]SPFILE       /u01/app/oracle/product/11.2.0.4/db_1/dbs/spfilevihd.ora

10 rows selected.

Oracle DBA

anuj blog Archive