rman对特定表空间迁移技术

   今天是2014-01-13,今天收到朋友一条qq消息,说是看一下备份数据迁移问题。

问题描述:

  生产有两个库A和B,A库是生产库,B库为测试库,且A库有3个表空间1,2,3,且只有1表空间为生产表空间数据量较小,其他两个表空间为测试且数据量非常大。当A库突然宕机,需要通过之前备份将A库的1表空间及时恢复到B库,以此来担任业务,为了尽快恢复数据,需要把2和3表空间排除掉,技术需要采用rman。

 解决方案:

 哈哈。我第一次听到这么样的情景,因为这种情况完全可以通过dg来解决此问题,另外对于该问题还可以使用expdp和impdp以及传输表空间技术来实现。

本例只是为了帮他测试,使用rman技术来完成此需求。

操作步骤:

[oracle@oracle-one ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Jan 13 09:53:02 2014

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

connected to target database: RHYS (DBID=2745484551)

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name RHYS are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 7;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%F‘; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE ON;
CONFIGURE ENCRYPTION ALGORITHM ‘AES128‘; # default
CONFIGURE COMPRESSION ALGORITHM ‘BASIC‘ AS OF RELEASE ‘DEFAULT‘ OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/opt/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_RHYS.f‘; # default

RMAN> configure controlfile autobackup on
2> ;

old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored


RMAN> backup database plus archivelog delete input;


Starting backup at 13-JAN-14
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=45 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=32 RECID=38 STAMP=835887568
input archived log thread=1 sequence=33 RECID=43 STAMP=835983664
input archived log thread=1 sequence=34 RECID=41 STAMP=835983651
input archived log thread=1 sequence=35 RECID=42 STAMP=835983661
channel ORA_DISK_1: starting piece 1 at 13-JAN-14
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup plus archivelog command at 01/13/2014 09:55:25
ORA-19914: unable to encrypt backup
ORA-28365: wallet is not open

RMAN> host;

[oracle@oracle-one ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jan 13 09:58:08 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> alter system set wallet open identified by "Amy";

System altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@oracle-one ~]$ exit
exit
host command complete

RMAN> backup database plus archivelog delete input;


Starting backup at 13-JAN-14
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=32 RECID=38 STAMP=835887568
input archived log thread=1 sequence=33 RECID=43 STAMP=835983664
input archived log thread=1 sequence=34 RECID=41 STAMP=835983651
input archived log thread=1 sequence=35 RECID=42 STAMP=835983661
channel ORA_DISK_1: starting piece 1 at 13-JAN-14
channel ORA_DISK_1: finished piece 1 at 13-JAN-14
piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/annnf0_tag20140113t100050_0.302.836733655 tag=TAG20140113T100050 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: deleting archived log(s)
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_03/thread_1_seq_32.312.835887567 RECID=38 STAMP=835887568
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_04/thread_1_seq_33.310.835983663 RECID=43 STAMP=835983664
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_04/thread_1_seq_34.282.835983651 RECID=41 STAMP=835983651
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_04/thread_1_seq_35.297.835983653 RECID=42 STAMP=835983661
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=44 STAMP=836132585
input archived log thread=1 sequence=2 RECID=45 STAMP=836165566
input archived log thread=1 sequence=3 RECID=46 STAMP=836176676
input archived log thread=1 sequence=4 RECID=47 STAMP=836178950
input archived log thread=1 sequence=5 RECID=48 STAMP=836232017
input archived log thread=1 sequence=6 RECID=49 STAMP=836234531
input archived log thread=1 sequence=7 RECID=50 STAMP=836237972
input archived log thread=1 sequence=8 RECID=51 STAMP=836256318
input archived log thread=1 sequence=9 RECID=52 STAMP=836299719
input archived log thread=1 sequence=10 RECID=53 STAMP=836337512
input archived log thread=1 sequence=11 RECID=54 STAMP=836494626
input archived log thread=1 sequence=12 RECID=55 STAMP=836498150
input archived log thread=1 sequence=13 RECID=56 STAMP=836731893
input archived log thread=1 sequence=14 RECID=57 STAMP=836733316
input archived log thread=1 sequence=15 RECID=58 STAMP=836733649
channel ORA_DISK_1: starting piece 1 at 13-JAN-14
channel ORA_DISK_1: finished piece 1 at 13-JAN-14
piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/annnf0_tag20140113t100050_0.297.836733683 tag=TAG20140113T100050 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: deleting archived log(s)
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_06/thread_1_seq_1.313.836132583 RECID=44 STAMP=836132585
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_06/thread_1_seq_2.314.836165563 RECID=45 STAMP=836165566
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_06/thread_1_seq_3.315.836176677 RECID=46 STAMP=836176676
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_06/thread_1_seq_4.273.836178949 RECID=47 STAMP=836178950
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_07/thread_1_seq_5.280.836232005 RECID=48 STAMP=836232017
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_07/thread_1_seq_6.278.836234531 RECID=49 STAMP=836234531
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_07/thread_1_seq_7.277.836237959 RECID=50 STAMP=836237972
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_07/thread_1_seq_8.272.836256311 RECID=51 STAMP=836256318
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_08/thread_1_seq_9.271.836299715 RECID=52 STAMP=836299719
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_08/thread_1_seq_10.308.836337507 RECID=53 STAMP=836337512
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_10/thread_1_seq_11.307.836494623 RECID=54 STAMP=836494626
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_10/thread_1_seq_12.306.836498149 RECID=55 STAMP=836498150
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_13.304.836731889 RECID=56 STAMP=836731893
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_14.305.836733317 RECID=57 STAMP=836733316
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_15.303.836733649 RECID=58 STAMP=836733649
Finished backup at 13-JAN-14

Starting backup at 13-JAN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATAGROUP1/rhys/datafile/system.257.833999503
input datafile file number=00002 name=+DATAGROUP1/rhys/datafile/sysaux.256.833999647
input datafile file number=00006 name=+DATAGROUP1/rhys/datafile/rhys.309.835132099
input datafile file number=00004 name=+DATAGROUP1/rhys/datafile/users.261.833999767
input datafile file number=00003 name=+DATAGROUP1/rhys/datafile/undotbs1.260.833999753
input datafile file number=00005 name=+DATAGROUP1/rhys/datafile/test.dbf
channel ORA_DISK_1: starting piece 1 at 13-JAN-14
channel ORA_DISK_1: finished piece 1 at 13-JAN-14
piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/nnndf0_tag20140113t100212_0.303.836733737 tag=TAG20140113T100212 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:06:26
Finished backup at 13-JAN-14

Starting backup at 13-JAN-14
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=16 RECID=59 STAMP=836734121
channel ORA_DISK_1: starting piece 1 at 13-JAN-14
channel ORA_DISK_1: finished piece 1 at 13-JAN-14
piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/annnf0_tag20140113t100843_0.274.836734125 tag=TAG20140113T100843 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: deleting archived log(s)
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_16.276.836734121 RECID=59 STAMP=836734121
Finished backup at 13-JAN-14

Starting Control File and SPFILE Autobackup at 13-JAN-14
piece handle=+DATAGROUP1/rhys/autobackup/2014_01_13/s_836734128.276.836734133 comment=NONE
Finished Control File and SPFILE Autobackup at 13-JAN-14

RMAN> exit


Recovery Manager complete.
[oracle@oracle-one ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jan 13 10:11:35 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
TEST
RHYS

7 rows selected.

SQL> select username,default_tablespace from dba_users;

USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
AMY                            TEST
SUDO                           USERS
RHYS                           USERS
SCOTT                          USERS
SYSTEM                         SYSTEM
SYS                            SYSTEM
SPATIAL_WFS_ADMIN_USR          USERS
SPATIAL_CSW_ADMIN_USR          USERS
APEX_PUBLIC_USER               USERS
DIP                            USERS
MDDATA                         USERS

USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
XS$NULL                        USERS
ORACLE_OCM                     USERS
OLAPSYS                        SYSAUX
SI_INFORMTN_SCHEMA             SYSAUX
OWBSYS                         SYSAUX
ORDPLUGINS                     SYSAUX
XDB                            SYSAUX
SYSMAN                         SYSAUX
ANONYMOUS                      SYSAUX
CTXSYS                         SYSAUX
ORDDATA                        SYSAUX

USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
OWBSYS_AUDIT                   SYSAUX
APEX_030200                    SYSAUX
APPQOSSYS                      SYSAUX
WMSYS                          SYSAUX
EXFSYS                         SYSAUX
ORDSYS                         SYSAUX
MDSYS                          SYSAUX
FLOWS_FILES                    SYSAUX
MGMT_VIEW                      SYSTEM
OUTLN                          SYSTEM
DBSNMP                         SYSAUX

33 rows selected.

SQL>
SQL> conn amy/root
ERROR:
ORA-01017: invalid username/password; logon denied


Warning: You are no longer connected to ORACLE.
SQL> conn amy/rhys
Connected.
SQL> select table_name from user_tables;

TABLE_NAME
------------------------------
T

SQL> select count(*) from t;

  COUNT(*)
----------
    227000

SQL> conn sys/root as sysdba
Connected.
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@oracle-one ~]$ sqlplus / as sysdba

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATAGROUP1/rhys/datafile/users.261.833999767
+DATAGROUP1/rhys/datafile/undotbs1.260.833999753
+DATAGROUP1/rhys/datafile/sysaux.256.833999647
+DATAGROUP1/rhys/datafile/system.257.833999503
+DATAGROUP1/rhys/datafile/test.dbf
+DATAGROUP1/rhys/datafile/rhys.309.835132099

6 rows selected.

SQL>    
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATAGROUP1/rhys/controlfile/current.259.833999445
+DATAGROUP1/rhys/controlfile/current.258.833999447

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@oracle-one ~]$ exit
logout
-bash-4.1$ amscmd
-bash: amscmd: command not found
-bash-4.1$ asmcmd
ASMCMD> cd +DATAGROUP1/rhys/datafile/
ASMCMD> ls
RHYS.309.835132099
SYSAUX.256.833999647
SYSAUX.270.833996599
SYSTEM.257.833999503
SYSTEM.262.833996425
TEST.283.834352325
UNDOTBS1.260.833999753
UNDOTBS1.268.833996545
USERS.261.833999767
USERS.269.833996553
test.dbf
ASMCMD> rm users.261.833999767
ASMCMD> rm undotbs1.260.833999753
ASMCMD> rm sysaux.256.833999647
ASMCMD> system.257.833999503
        commands:
        --------

        md_backup, md_restore

        lsattr, setattr

        cd, cp, du, find, help, ls, lsct, lsdg, lsof, mkalias
        mkdir, pwd, rm, rmalias

        chdg, chkdg, dropdg, iostat, lsdsk, lsod, mkdg, mount
        offline, online, rebal, remap, umount

        dsget, dsset, lsop, shutdown, spbackup, spcopy, spget
        spmove, spset, startup

        chtmpl, lstmpl, mktmpl, rmtmpl

        chgrp, chmod, chown, groups, grpmod, lsgrp, lspwusr, lsusr
        mkgrp, mkusr, orapwusr, passwd, rmgrp, rmusr

        volcreate, voldelete, voldisable, volenable, volinfo
        volresize, volset, volstat

ASMCMD> rm system.257.833999503
ASMCMD> rm rhys.309.835132099
ASMCMD> rm test.dbf
ASMCMD> cd +DATAGROUP1/rhys/controlfile/
ASMCMD> ls
current.258.833999447
current.259.833999445
current.263.833995907
current.264.833995903
current.265.833995175
current.266.833995171
ASMCMD> rm current.259.833999445
ASMCMD> rm current.258.833999447
exiASMCMD> t
-bash-4.1$ su - oracle
Password:
[oracle@oracle-one ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Jan 13 10:20:03 2014

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

connected to target database (not started)

RMAN> startup nomount

Oracle instance started

Total System Global Area     626327552 bytes

Fixed Size                     2255832 bytes
Variable Size                398459944 bytes
Database Buffers             222298112 bytes
Redo Buffers                   3313664 bytes

RMAN> restore controfile from ‘+DATAGROUP1/rhys/autobackup/2014_01_13/s_836734128.276.836734133‘;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "archivelog, channel, check, controlfile, database, datafile, device, force, from, high, preview, primary, skip readonly, spfile, standby, tablespace, to restore point, until restore point, until, validate, ("
RMAN-01008: the bad identifier was: controfile
RMAN-01007: at line 1 column 9 file: standard input

RMAN> restore controlfile from "+DATAGROUP1/rhys/autobackup/2014_01_13/s_836734128.276.836734133";

Starting restore at 13-JAN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK

channel ORA_DISK_1: restoring control file
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/13/2014 10:21:53
ORA-19870: error while restoring backup piece +DATAGROUP1/rhys/autobackup/2014_01_13/s_836734128.276.836734133
ORA-19913: unable to decrypt backup
ORA-28365: wallet is not open

RMAN> sql ‘alter system wallet open identified by "Amy";
2> ‘;

sql statement: alter system wallet open identified by "Amy";
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 01/13/2014 10:22:25
RMAN-11003: failure during parse/execution of SQL statement: alter system wallet open identified by "Amy";
ORA-02065: illegal option for ALTER SYSTEM

RMAN> exit


Recovery Manager complete.
[oracle@oracle-one ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jan 13 10:22:32 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> alter system set wallet open identified by "Amy";

System altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@oracle-one ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Jan 13 10:22:48 2014

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

connected to target database: RHYS (not mounted)

RMAN>  restore controlfile from "+DATAGROUP1/rhys/autobackup/2014_01_13/s_836734128.276.836734133";

Starting restore at 13-JAN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
output file name=+DATAGROUP1/rhys/controlfile/current.258.836734979
output file name=+DATAGROUP1/rhys/controlfile/current.259.836734983
Finished restore at 13-JAN-14

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> restore database skip forever tablespace users,rhys;

Starting restore at 13-JAN-14
Starting implicit crosscheck backup at 13-JAN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
Crosschecked 6 objects
Finished implicit crosscheck backup at 13-JAN-14

Starting implicit crosscheck copy at 13-JAN-14
using channel ORA_DISK_1
Crosschecked 12 objects
Finished implicit crosscheck copy at 13-JAN-14

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +datagroup1/RHYS/AUTOBACKUP/2014_01_13/s_836734128.276.836734133
File Name: +datagroup1/RHYS/AUTOBACKUP/2013_12_12/s_833994468.281.833994471
File Name: +datagroup1/RHYS/ARCHIVELOG/2014_01_13/thread_1_seq_17.291.836734553

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATAGROUP1/rhys/datafile/system.257.833999503
channel ORA_DISK_1: restoring datafile 00002 to +DATAGROUP1/rhys/datafile/sysaux.256.833999647
channel ORA_DISK_1: restoring datafile 00003 to +DATAGROUP1/rhys/datafile/undotbs1.260.833999753
channel ORA_DISK_1: restoring datafile 00005 to +DATAGROUP1/rhys/datafile/test.dbf
channel ORA_DISK_1: reading from backup piece +DATAGROUP1/rhys/backupset/2014_01_13/nnndf0_tag20140113t100212_0.303.836733737
channel ORA_DISK_1: piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/nnndf0_tag20140113t100212_0.303.836733737 tag=TAG20140113T100212
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:05:06
Finished restore at 13-JAN-14

RMAN> recover database skip forever tablespace users,rhys;

Starting recover at 13-JAN-14
using channel ORA_DISK_1

Executing: alter database datafile 4 offline drop
Executing: alter database datafile 6 offline drop
starting media recovery

archived log for thread 1 with sequence 16 is already on disk as file +DATAGROUP1/rhys/onlinelog/group_1.285.833999951
archived log for thread 1 with sequence 17 is already on disk as file +DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_17.291.836734553
archived log for thread 1 with sequence 18 is already on disk as file +DATAGROUP1/rhys/onlinelog/group_3.288.833999983
archived log file name=+DATAGROUP1/rhys/onlinelog/group_1.285.833999951 thread=1 sequence=16
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_17.291.836734553 thread=1 sequence=17
archived log file name=+DATAGROUP1/rhys/onlinelog/group_3.288.833999983 thread=1 sequence=18
media recovery complete, elapsed time: 00:00:10
Finished recover at 13-JAN-14

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 01/13/2014 10:31:16
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> exit


Recovery Manager complete.
[oracle@oracle-one ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jan 13 10:31:23 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> alter database open read only;

Database altered.

SQL> set name for a50
SP2-0158: unknown SET option "name"
SQL> col name for a50
SQL> set linesize 200
SQL> col status for a30
SQL> select file#,name,status from v$datafile;

     FILE# NAME                                               STATUS
---------- -------------------------------------------------- ------------------------------
         1 +DATAGROUP1/rhys/datafile/system.311.836735137     SYSTEM
         2 +DATAGROUP1/rhys/datafile/sysaux.279.836735137     ONLINE
         3 +DATAGROUP1/rhys/datafile/undotbs1.257.836735137   ONLINE
         4 +DATAGROUP1/rhys/datafile/users.261.833999767      RECOVER
         5 +DATAGROUP1/rhys/datafile/test.dbf                 ONLINE
         6 +DATAGROUP1/rhys/datafile/rhys.309.835132099       RECOVER

6 rows selected.

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

Total System Global Area  626327552 bytes
Fixed Size                  2255832 bytes
Variable Size             398459944 bytes
Database Buffers          222298112 bytes
Redo Buffers                3313664 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

SQL> select file#,name,status from v$datafile;

     FILE# NAME                                               STATUS
---------- -------------------------------------------------- ------------------------------
         1 +DATAGROUP1/rhys/datafile/system.311.836735137     SYSTEM
         2 +DATAGROUP1/rhys/datafile/sysaux.279.836735137     ONLINE
         3 +DATAGROUP1/rhys/datafile/undotbs1.257.836735137   ONLINE
         4 +DATAGROUP1/rhys/datafile/users.261.833999767      OFFLINE
         5 +DATAGROUP1/rhys/datafile/test.dbf                 ONLINE
         6 +DATAGROUP1/rhys/datafile/rhys.309.835132099       OFFLINE

6 rows selected.

SQL> drop tablespace users including contents and datafiles;
drop tablespace users including contents and datafiles
*
ERROR at line 1:
ORA-12919: Can not drop the default permanent tablespace


SQL> drop tablespace rhys including contents and datafiles;

Tablespace dropped.

SQL>
SQL> alter database default tablespace test;

Database altered.

SQL> drop tablespace users including contents and datafiles;

Tablespace dropped.

SQL> select file#,name,status from v$datafile;

     FILE# NAME                                               STATUS
---------- -------------------------------------------------- ------------------------------
         1 +DATAGROUP1/rhys/datafile/system.311.836735137     SYSTEM
         2 +DATAGROUP1/rhys/datafile/sysaux.279.836735137     ONLINE
         3 +DATAGROUP1/rhys/datafile/undotbs1.257.836735137   ONLINE
         5 +DATAGROUP1/rhys/datafile/test.dbf                 ONLINE

SQL> conn amy/rhys
Connected.
SQL> select count(*) from t;

  COUNT(*)
----------
    227000

 

 

rman对特定表空间迁移技术

上一篇:taobao网店观察


下一篇:windows批处理bat中字体颜色设置