Wednesday, 12 June 2013

tablespace point in time recovery using SCN (RMAN)

tablespace point in time recovery using SCN (RMAN).

  I got this solution after visit number links regarding  rman backup and recovery.I sort all documents and perform this practical on test database and got desired result.

Example:-

SQL>  select name from v$tablespace;

NAME
---------------------------------------------------
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
RAVI
TEST


6 rows selected.

SQL> conn test/test
Connected.
SQL> create table test1(id number);

Table created.

SQL>  begin
  for i in 1..10 loop
   insert into test values(i);
   end loop;
   end;
    /

SQL> commit;

Commit complete.

SQL> select count(*) from test;

  COUNT(*)
----------
        10

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@orcl ~]$ rman
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jun 12 16:55:01 2013

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

RMAN> connect target

connected to target database: DB11G (DBID=287159184)


RMAN> run
2> {
3>   ALLOCATE CHANNEL ch1 TYPE
4>     DISK FORMAT '/u01/backup/DB11G/%d_DB_%u_%s_%p';
5>   BACKUP DATABASE plus ARCHIVELOG;
6>   backup current controlfile;
7>   RELEASE CHANNEL ch1;
8> }
9> EXIT;

using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=1 device type=DISK


Starting backup at 12-JUN-13
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=3 RECID=1 STAMP=817500225
input archived log thread=1 sequence=4 RECID=2 STAMP=817500225
input archived log thread=1 sequence=5 RECID=3 STAMP=817500227
input archived log thread=1 sequence=6 RECID=4 STAMP=817500259
input archived log thread=1 sequence=7 RECID=5 STAMP=817500260
input archived log thread=1 sequence=8 RECID=6 STAMP=817500263
input archived log thread=1 sequence=9 RECID=7 STAMP=817500267
input archived log thread=1 sequence=10 RECID=8 STAMP=817500282
input archived log thread=1 sequence=11 RECID=9 STAMP=817500283
input archived log thread=1 sequence=12 RECID=10 STAMP=817500284
input archived log thread=1 sequence=13 RECID=11 STAMP=817500284
input archived log thread=1 sequence=14 RECID=12 STAMP=817510623
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1coc118o_44_1 tag=TAG20130612T165551 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:04
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=19 STAMP=817749472
input archived log thread=1 sequence=2 RECID=20 STAMP=817749579
input archived log thread=1 sequence=3 RECID=21 STAMP=817759858
input archived log thread=1 sequence=4 RECID=22 STAMP=817774302
input archived log thread=1 sequence=5 RECID=23 STAMP=817842613
input archived log thread=1 sequence=6 RECID=24 STAMP=817851202
input archived log thread=1 sequence=7 RECID=25 STAMP=817851369
input archived log thread=1 sequence=8 RECID=26 STAMP=817851598
input archived log thread=1 sequence=9 RECID=27 STAMP=817851600
input archived log thread=1 sequence=10 RECID=28 STAMP=817851605
input archived log thread=1 sequence=11 RECID=29 STAMP=817851624
input archived log thread=1 sequence=12 RECID=30 STAMP=817855047
input archived log thread=1 sequence=13 RECID=31 STAMP=817855512
input archived log thread=1 sequence=14 RECID=32 STAMP=817855642
input archived log thread=1 sequence=15 RECID=33 STAMP=817911008
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1doc118s_45_1 tag=TAG20130612T165551 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:15
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=21 RECID=18 STAMP=817749346
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1eoc119b_46_1 tag=TAG20130612T165551 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:04
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=16 RECID=34 STAMP=817914817
input archived log thread=1 sequence=17 RECID=35 STAMP=817914938
input archived log thread=1 sequence=18 RECID=36 STAMP=817917655
input archived log thread=1 sequence=19 RECID=37 STAMP=817917656
input archived log thread=1 sequence=20 RECID=38 STAMP=817917661
input archived log thread=1 sequence=21 RECID=39 STAMP=817918877
input archived log thread=1 sequence=22 RECID=40 STAMP=817919815
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1foc119f_47_1 tag=TAG20130612T165551 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=22 RECID=16 STAMP=817749341
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1goc119g_48_1 tag=TAG20130612T165551 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:04
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=23 RECID=41 STAMP=817920792
input archived log thread=1 sequence=24 RECID=42 STAMP=817920917
input archived log thread=1 sequence=25 RECID=43 STAMP=817922548
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1hoc119k_49_1 tag=TAG20130612T165551 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=23 RECID=17 STAMP=817749343
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1ioc119l_50_1 tag=TAG20130612T165551 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:04
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=26 RECID=44 STAMP=817923351
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1joc119p_51_1 tag=TAG20130612T165551 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-JUN-13

Starting backup at 12-JUN-13
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/db11g/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/db11g/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/db11g/undotbs01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/db11g/ravi01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/db11g/users01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/db11g/test01.dbf
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1koc119r_52_1 tag=TAG20130612T165626 comment=NONE
channel ch1: backup set complete, elapsed time: 00:01:16
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1loc11c7_53_1 tag=TAG20130612T165626 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-JUN-13

Starting backup at 12-JUN-13
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=27 RECID=45 STAMP=817923467
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1moc11cc_54_1 tag=TAG20130612T165748 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-JUN-13

Starting backup at 12-JUN-13
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
including current control file in backup set
channel ch1: starting piece 1 at 12-JUN-13
channel ch1: finished piece 1 at 12-JUN-13
piece handle=/u01/backup/DB11G/DB11G_DB_1noc11cd_55_1 tag=TAG20130612T165749 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-JUN-13

released channel: ch1

Recovery Manager complete.


[oracle@orcl u01]$ sqlplus

SQL> conn sys/admin as sysdba

SQL> alter system switch logfile;

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL>

SQL> create tablespace test_1 datafile '/u01/app/oracle/oradata/db11g/test_101.dbf' size 2m;


SQL> select name from v$tablespace;

NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
RAVI
TEST
TEST_1

8 rows selected.


SQL> create user test1
  2  identified by test1
  3  default tablespace test_1;

User created.

SQL>  grant connect, resource to test;

Grant succeeded.



SQL> create table test_1(id number);

Table created.

SQL> begin
  for i in 1..10 loop
   insert into test_1 values(i);
   end loop;
   end;
    /  2    3    4    5    6

PL/SQL procedure successfully completed.

SQL> commit;

Commit complete.

SQL> select count(*) from test_1;

  COUNT(*)
----------
        10



SQL> set time on;
17:03:43 SQL> connect test/test
Connected.
17:04:09 SQL> drop table test;

Table dropped.

17:04:15 SQL>  conn sys/admin as sysdba
Connected.

17:04:39 SQL> col name format a51;
17:06:15 SQL> col status for a10;
17:06:26 SQL> select name,status from v$datafile;

NAME                                                STATUS
--------------------------------------------------- ----------
/u01/app/oracle/oradata/db11g/system01.dbf          SYSTEM
/u01/app/oracle/oradata/db11g/sysaux01.dbf          ONLINE
/u01/app/oracle/oradata/db11g/undotbs01.dbf         ONLINE
/u01/app/oracle/oradata/db11g/users01.dbf           ONLINE
/u01/app/oracle/oradata/db11g/ravi01.dbf            ONLINE
/u01/app/oracle/oradata/db11g/test01.dbf            ONLINE
/u01/app/oracle/oradata/db11g/test_101.dbf          ONLINE


17:07:15 SQL> alter tablespace test offline immediate;

Tablespace altered.

17:07:30 SQL> select name,status from v$datafile;

NAME                                                STATUS
--------------------------------------------------- ----------
/u01/app/oracle/oradata/db11g/system01.dbf          SYSTEM
/u01/app/oracle/oradata/db11g/sysaux01.dbf          ONLINE
/u01/app/oracle/oradata/db11g/undotbs01.dbf         ONLINE
/u01/app/oracle/oradata/db11g/users01.dbf           ONLINE
/u01/app/oracle/oradata/db11g/ravi01.dbf            ONLINE
/u01/app/oracle/oradata/db11g/test01.dbf            RECOVER
/u01/app/oracle/oradata/db11g/test_101.dbf          ONLINE

7 rows selected.


17:08:16 SQL> connect test1/test1
Connected.

17:08:31 SQL> create table test2(id number);

Table created.



17:09:38 SQL>  begin
  for i in 1..10 loop
   insert into test2 values(i);
   end loop;
   end;
    /

PL/SQL procedure successfully completed.

17:09:48 SQL> commit;

Commit complete.

17:09:51 SQL> select count(*) from test2;

  COUNT(*)
----------
        10


[oracle@orcl u01]$ rman

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jun 12 15:35:30 2013

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

RMAN> connect target

connected to target database: DB11G (DBID=287159184)

RMAN> list backup;

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
42      28.78M     DISK        00:00:02     12-JUN-13
        BP Key: 42   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165551
        Piece Name: /u01/backup/DB11G/DB11G_DB_1coc118o_44_1

  List of Archived Logs in backup set 42
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    3       785707     07-JUN-13 786173     07-JUN-13
  1    4       786173     07-JUN-13 786176     07-JUN-13
  1    5       786176     07-JUN-13 810540     07-JUN-13
  1    6       810540     07-JUN-13 810667     07-JUN-13
  1    7       810667     07-JUN-13 810670     07-JUN-13
  1    8       810670     07-JUN-13 810674     07-JUN-13
  1    9       810674     07-JUN-13 810677     07-JUN-13
  1    10      810677     07-JUN-13 810682     07-JUN-13
  1    11      810682     07-JUN-13 810685     07-JUN-13
  1    12      810685     07-JUN-13 810688     07-JUN-13
  1    13      810688     07-JUN-13 810691     07-JUN-13
  1    14      810691     07-JUN-13 821070     07-JUN-13

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
43      179.38M    DISK        00:00:14     12-JUN-13
        BP Key: 43   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165551
        Piece Name: /u01/backup/DB11G/DB11G_DB_1doc118s_45_1

  List of Archived Logs in backup set 43
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    1       821082     10-JUN-13 821493     10-JUN-13
  1    2       821493     10-JUN-13 821525     10-JUN-13
  1    3       821525     10-JUN-13 827239     10-JUN-13
  1    4       827239     10-JUN-13 842360     10-JUN-13
  1    5       842360     10-JUN-13 871981     11-JUN-13
  1    6       871981     11-JUN-13 876028     11-JUN-13
  1    7       876028     11-JUN-13 876124     11-JUN-13
  1    8       876124     11-JUN-13 876307     11-JUN-13
  1    9       876307     11-JUN-13 876311     11-JUN-13
  1    10      876311     11-JUN-13 876315     11-JUN-13
  1    11      876315     11-JUN-13 876321     11-JUN-13
  1    12      876321     11-JUN-13 878372     11-JUN-13
  1    13      878372     11-JUN-13 882722     11-JUN-13
  1    14      882722     11-JUN-13 882772     11-JUN-13
  1    15      882772     11-JUN-13 909083     12-JUN-13

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
44      40.57M     DISK        00:00:02     12-JUN-13
        BP Key: 44   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165551
        Piece Name: /u01/backup/DB11G/DB11G_DB_1eoc119b_46_1

  List of Archived Logs in backup set 44
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    21      902545     09-JUN-13 921147     09-JUN-13

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
45      5.68M      DISK        00:00:01     12-JUN-13
        BP Key: 45   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165551
        Piece Name: /u01/backup/DB11G/DB11G_DB_1foc119f_47_1

  List of Archived Logs in backup set 45
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    16      909083     12-JUN-13 911013     12-JUN-13
  1    17      911013     12-JUN-13 911052     12-JUN-13
  1    18      911052     12-JUN-13 912283     12-JUN-13
  1    19      912283     12-JUN-13 912286     12-JUN-13
  1    20      912286     12-JUN-13 912292     12-JUN-13
  1    21      912292     12-JUN-13 913442     12-JUN-13
  1    22      913442     12-JUN-13 933915     12-JUN-13

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
46      38.70M     DISK        00:00:02     12-JUN-13
        BP Key: 46   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165551
        Piece Name: /u01/backup/DB11G/DB11G_DB_1goc119g_48_1

  List of Archived Logs in backup set 46
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    22      921147     09-JUN-13 935457     10-JUN-13

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
47      2.72M      DISK        00:00:00     12-JUN-13
        BP Key: 47   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165551
        Piece Name: /u01/backup/DB11G/DB11G_DB_1hoc119k_49_1

  List of Archived Logs in backup set 47
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    23      933915     12-JUN-13 934937     12-JUN-13
  1    24      934937     12-JUN-13 934975     12-JUN-13
  1    25      934975     12-JUN-13 935842     12-JUN-13

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
48      32.13M     DISK        00:00:02     12-JUN-13
        BP Key: 48   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165551
        Piece Name: /u01/backup/DB11G/DB11G_DB_1ioc119l_50_1

  List of Archived Logs in backup set 48
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    23      935457     10-JUN-13 960820     10-JUN-13

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
49      733.50K    DISK        00:00:00     12-JUN-13
        BP Key: 49   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165551
        Piece Name: /u01/backup/DB11G/DB11G_DB_1joc119p_51_1

  List of Archived Logs in backup set 49
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    26      935842     12-JUN-13 936718     12-JUN-13

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
50      Full    959.59M    DISK        00:01:08     12-JUN-13
        BP Key: 50   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165626
        Piece Name: /u01/backup/DB11G/DB11G_DB_1koc119r_52_1
  List of Datafiles in backup set 50
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 936730     12-JUN-13 /u01/app/oracle/oradata/db11g/system01.dbf
  2       Full 936730     12-JUN-13 /u01/app/oracle/oradata/db11g/sysaux01.dbf
  3       Full 936730     12-JUN-13 /u01/app/oracle/oradata/db11g/undotbs01.dbf
  4       Full 936730     12-JUN-13 /u01/app/oracle/oradata/db11g/users01.dbf
  5       Full 936730     12-JUN-13 /u01/app/oracle/oradata/db11g/ravi01.dbf
  6       Full 936730     12-JUN-13 /u01/app/oracle/oradata/db11g/test01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
51      Full    9.39M      DISK        00:00:04     12-JUN-13
        BP Key: 51   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165626
        Piece Name: /u01/backup/DB11G/DB11G_DB_1loc11c7_53_1
  SPFILE Included: Modification time: 12-JUN-13
  SPFILE db_unique_name: DB11G
  Control File Included: Ckp SCN: 936750       Ckp time: 12-JUN-13

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
52      14.00K     DISK        00:00:00     12-JUN-13
        BP Key: 52   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165748
        Piece Name: /u01/backup/DB11G/DB11G_DB_1moc11cc_54_1

  List of Archived Logs in backup set 52
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    27      936718     12-JUN-13 936756     12-JUN-13

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
53      Full    9.36M      DISK        00:00:02     12-JUN-13
        BP Key: 53   Status: AVAILABLE  Compressed: NO  Tag: TAG20130612T165749
        Piece Name: /u01/backup/DB11G/DB11G_DB_1noc11cd_55_1
  Control File Included: Ckp SCN: 936765       Ckp time: 12-JUN-13



RMAN> run
{
recover tablespace 'TEST'
until scn 936765
AUXILIARY DESTINATION '/u01/auxilary';
}



Starting recover at 12-JUN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=43 device type=DISK
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified point-in-time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1

Creating automatic instance, with SID='ltix'

initialization parameters used for automatic instance:
db_name=DB11G
db_unique_name=ltix_tspitr_DB11G
compatible=11.2.0.0.0
db_block_size=8192
db_files=200
sga_target=280M
processes=50
db_create_file_dest=/u01/auxilary
log_archive_dest_1='location=/u01/auxilary'
#No auxiliary parameter file used


starting up automatic instance DB11G

Oracle instance started

Total System Global Area     292933632 bytes

Fixed Size                     1336092 bytes
Variable Size                100666596 bytes
Database Buffers             184549376 bytes
Redo Buffers                   6381568 bytes
Automatic instance created
Running TRANSPORT_SET_CHECK on recovery set tablespaces
TRANSPORT_SET_CHECK completed successfully

contents of Memory Script:
{
# set requested point in time
set until  scn 936765;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log
sql 'alter system archive log current';
# avoid unnecessary autobackups for structural changes during TSPITR
sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;';
}
executing Memory Script

executing command: SET until clause

Starting restore at 12-JUN-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/backup/DB11G/DB11G_DB_1noc11cd_55_1
channel ORA_AUX_DISK_1: piece handle=/u01/backup/DB11G/DB11G_DB_1noc11cd_55_1 tag=TAG20130612T165749
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/auxilary/DB11G/controlfile/o1_mf_8vjr943b_.ctl
Finished restore at 12-JUN-13

sql statement: alter database mount clone database

sql statement: alter system archive log current

sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;

contents of Memory Script:
{
# set requested point in time
set until  scn 936765;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  2 to new;
set newname for clone tempfile  1 to new;
set newname for datafile  6 to
 "/u01/app/oracle/oradata/db11g/test01.dbf";
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 3, 2, 6;
switch clone datafile all;
}
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

renamed tempfile 1 to /u01/auxilary/DB11G/datafile/o1_mf_temp_%u_.tmp in control file

Starting restore at 12-JUN-13
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/auxilary/DB11G/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/auxilary/DB11G/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/auxilary/DB11G/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/db11g/test01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/backup/DB11G/DB11G_DB_1koc119r_52_1
channel ORA_AUX_DISK_1: piece handle=/u01/backup/DB11G/DB11G_DB_1koc119r_52_1 tag=TAG20130612T165626
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 12-JUN-13

datafile 1 switched to datafile copy
input datafile copy RECID=4 STAMP=817925043 file name=/u01/auxilary/DB11G/datafile/o1_mf_system_8vjr9ft2_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=817925043 file name=/u01/auxilary/DB11G/datafile/o1_mf_undotbs1_8vjr9ftv_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=817925043 file name=/u01/auxilary/DB11G/datafile/o1_mf_sysaux_8vjr9ftr_.dbf

contents of Memory Script:
{
# set requested point in time
set until  scn 936765;
# online the datafiles restored or switched
sql clone "alter database datafile  1 online";
sql clone "alter database datafile  3 online";
sql clone "alter database datafile  2 online";
sql clone "alter database datafile  6 online";
# recover and open resetlogs
recover clone database tablespace  "TEST", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  1 online

sql statement: alter database datafile  3 online

sql statement: alter database datafile  2 online

sql statement: alter database datafile  6 online

Starting recover at 12-JUN-13
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 27 is already on disk as file /u01/archivelog/arch_1_27_817749339.arc
archived log for thread 1 with sequence 28 is already on disk as file /u01/archivelog/arch_1_28_817749339.arc
archived log file name=/u01/archivelog/arch_1_27_817749339.arc thread=1 sequence=27
archived log file name=/u01/archivelog/arch_1_28_817749339.arc thread=1 sequence=28
media recovery complete, elapsed time: 00:00:01
Finished recover at 12-JUN-13

database opened

contents of Memory Script:
{
# make read only the tablespace that will be exported
sql clone 'alter tablespace  "TEST" read only';
# create directory for datapump import
sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/u01/auxilary''";
# create directory for datapump export
sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/u01/auxilary''";
}
executing Memory Script

sql statement: alter tablespace  "TEST" read only

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/auxilary''

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/auxilary''

Performing export of metadata...
   EXPDP> Starting "SYS"."TSPITR_EXP_ltix":
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
   EXPDP> Master table "SYS"."TSPITR_EXP_ltix" successfully loaded/unloaded
   EXPDP> ******************************************************************************
   EXPDP> Dump file set for SYS.TSPITR_EXP_ltix is:
   EXPDP>   /u01/auxilary/tspitr_ltix_72884.dmp
   EXPDP> ******************************************************************************
   EXPDP> Datafiles required for transportable tablespace TEST:
   EXPDP>   /u01/app/oracle/oradata/db11g/test01.dbf
   EXPDP> Job "SYS"."TSPITR_EXP_ltix" successfully completed at 17:26:08
Export completed


contents of Memory Script:
{
# shutdown clone before import
shutdown clone immediate
# drop target tablespaces before importing them back
sql 'drop tablespace  "TEST" including contents keep datafiles';
}
executing Memory Script

database closed
database dismounted
Oracle instance shut down

sql statement: drop tablespace  "TEST" including contents keep datafiles

Performing import of metadata...
   IMPDP> Master table "SYS"."TSPITR_IMP_ltix" successfully loaded/unloaded
   IMPDP> Starting "SYS"."TSPITR_IMP_ltix":
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
   IMPDP> Job "SYS"."TSPITR_IMP_ltix" successfully completed at 17:27:15
Import completed


contents of Memory Script:
{
# make read write and offline the imported tablespaces
sql 'alter tablespace  "TEST" read write';
sql 'alter tablespace  "TEST" offline';
# enable autobackups after TSPITR is finished
sql 'begin dbms_backup_restore.AutoBackupFlag(TRUE); end;';
}
executing Memory Script

sql statement: alter tablespace  "TEST" read write

sql statement: alter tablespace  "TEST" offline

sql statement: begin dbms_backup_restore.AutoBackupFlag(TRUE); end;

Removing automatic instance
Automatic instance removed
auxiliary instance file /u01/auxilary/DB11G/datafile/o1_mf_temp_8vjrc9z4_.tmp deleted
auxiliary instance file /u01/auxilary/DB11G/onlinelog/o1_mf_3_8vjrc34l_.log deleted
auxiliary instance file /u01/auxilary/DB11G/onlinelog/o1_mf_2_8vjrc1vp_.log deleted
auxiliary instance file /u01/auxilary/DB11G/onlinelog/o1_mf_1_8vjrc0gv_.log deleted
auxiliary instance file /u01/auxilary/DB11G/datafile/o1_mf_sysaux_8vjr9ftr_.dbf deleted
auxiliary instance file /u01/auxilary/DB11G/datafile/o1_mf_undotbs1_8vjr9ftv_.dbf deleted
auxiliary instance file /u01/auxilary/DB11G/datafile/o1_mf_system_8vjr9ft2_.dbf deleted
auxiliary instance file /u01/auxilary/DB11G/controlfile/o1_mf_8vjr943b_.ctl deleted
Finished recover at 12-JUN-13


RMAN> exit


Recovery Manager complete.
[oracle@orcl u01]$sqlplus

SQL> conn test/test
Connected.
SQL> select count(*) from test;
select count(*) from test
                     *
ERROR at line 1:
ORA-00376: file 6 cannot be read at this time
ORA-01110: data file 6: '/u01/app/oracle/oradata/db11g/test01.dbf'

SQL> conn /as sysdba
Connected.
SQL> alter tablespace test online;

Tablespace altered.

SQL> conn test/test;
Connected.
SQL> select count(*) from test;

  COUNT(*)
----------
        10









No comments:

Post a Comment

work on autovacuum postgreSQL parameter

 In This blog, we are discussing the auto vacuum parameter on a small scale. we will understand the below parameters and will see how to mod...