search
HomeDatabaseMysql Tutorialrman对特定表空间迁移技术

rman对特定表空间迁移技术

Jun 07, 2016 pm 03:28 PM
technologyidentificationspacemigrate

今天是2014-01-13,今天收到朋友一条qq消息,说是看一下备份数据迁移问题。 问题描述: 生产有两个库A和B,A库是生产库,B库为测试库,且A库有3个表空间1,2,3,且只有1表空间为生产表空间数据量较小,其他两个表空间为测试且数据量非常大。当A库突然宕机,

今天是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

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Explain the InnoDB Buffer Pool and its importance for performance.Explain the InnoDB Buffer Pool and its importance for performance.Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL vs. Other Programming Languages: A ComparisonMySQL vs. Other Programming Languages: A ComparisonApr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Learning MySQL: A Step-by-Step Guide for New UsersLearning MySQL: A Step-by-Step Guide for New UsersApr 19, 2025 am 12:19 AM

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL: Essential Skills for Beginners to MasterMySQL: Essential Skills for Beginners to MasterApr 18, 2025 am 12:24 AM

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL: Structured Data and Relational DatabasesMySQL: Structured Data and Relational DatabasesApr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL: Key Features and Capabilities ExplainedMySQL: Key Features and Capabilities ExplainedApr 18, 2025 am 12:17 AM

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

The Purpose of SQL: Interacting with MySQL DatabasesThe Purpose of SQL: Interacting with MySQL DatabasesApr 18, 2025 am 12:12 AM

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

MySQL for Beginners: Getting Started with Database ManagementMySQL for Beginners: Getting Started with Database ManagementApr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools