欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

Oracle學(xué)習(xí)之RMAN(十五)恢復(fù)實(shí)戰(zhàn)--TSPITR

  TSPITR是英文Tablespace Point In Time Recovery的縮寫(xiě)。也就是表空間定點(diǎn)時(shí)間恢復(fù)。TSPITR是一種相對(duì)細(xì)粒度的不完全恢復(fù)技術(shù)。我們通常見(jiàn)到的還原操作,都是將所有的表空間和數(shù)據(jù)還原到相同的一個(gè)時(shí)間點(diǎn)上。而TSPITR則是以表空間為粒度單元,單獨(dú)將某個(gè)表空間內(nèi)容還原到一個(gè)特定可恢復(fù)時(shí)間點(diǎn)上。舉一個(gè)例子:一個(gè)Oracle數(shù)據(jù)庫(kù)運(yùn)行在歸檔模式下,在夜間零時(shí)保留一份完全備份。早上七點(diǎn)時(shí)候,某個(gè)特定表空間上數(shù)據(jù)表(單個(gè)表獨(dú)占表空間)發(fā)生一個(gè)誤操作,數(shù)據(jù)損壞。要求在不傷害其他數(shù)據(jù)表數(shù)據(jù)的情況下,將表空間數(shù)據(jù)恢復(fù)到早上六點(diǎn)。這樣部分?jǐn)?shù)據(jù)恢復(fù)的場(chǎng)景,就是TSPITR的典型應(yīng)用。

創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿(mǎn)足客戶(hù)于互聯(lián)網(wǎng)時(shí)代的新平網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

1. 建立一個(gè)表空間

SQL> create tablespace tspitr datafile '/u01/app/oracle/oradata/devdb/tspitr01.dbf' size 20M;

Tablespace created.

2. 在這個(gè)表空間上創(chuàng)建一個(gè)表,并插入數(shù)據(jù)

SQL> conn scott/tiger
Connected.
SQL> create table t_tspitr_test tablespace tspitr as select * from emp;

Table created.

SQL> select count(*) from t_tspitr_test;

  COUNT(*)
----------
	14

3. 對(duì)數(shù)據(jù)庫(kù)做一個(gè)備份

RMAN> backup database plus archivelog delete all input;


Starting backup at 2015/07/09 14:40:29
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=3 RECID=1 STAMP=884613136
channel ORA_DISK_1: starting piece 1 at 2015/07/09 14:40:30
channel ORA_DISK_1: finished piece 1 at 2015/07/09 14:40:31
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_annnn_TAG20150709T144030_bsw5ty9m_.bkp tag=TAG20150709T144030 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_09/o1_mf_1_3_bsw30j7b_.arc RECID=1 STAMP=884613136
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=2 STAMP=884616029
channel ORA_DISK_1: starting piece 1 at 2015/07/09 14:40:31
channel ORA_DISK_1: finished piece 1 at 2015/07/09 14:40:32
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_annnn_TAG20150709T144030_bsw5tzsf_.bkp tag=TAG20150709T144030 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_09/o1_mf_1_1_bsw5txwl_.arc RECID=2 STAMP=884616029
Finished backup at 2015/07/09 14:40:32

Starting backup at 2015/07/09 14:40:32
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=/u01/app/oracle/oradata/devdb/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/devdb/tspitr01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2015/07/09 14:40:33
channel ORA_DISK_1: finished piece 1 at 2015/07/09 14:42:18
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T144032_bsw5v1cb_.bkp tag=TAG20150709T144032 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:45
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2015/07/09 14:42:19
channel ORA_DISK_1: finished piece 1 at 2015/07/09 14:42:20
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T144032_bsw5ycl2_.bkp tag=TAG20150709T144032 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015/07/09 14:42:20

Starting backup at 2015/07/09 14:42:20
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=2 RECID=3 STAMP=884616140
channel ORA_DISK_1: starting piece 1 at 2015/07/09 14:42:20
channel ORA_DISK_1: finished piece 1 at 2015/07/09 14:42:21
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_annnn_TAG20150709T144220_bsw5ydxj_.bkp tag=TAG20150709T144220 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_09/o1_mf_1_2_bsw5ydp6_.arc RECID=3 STAMP=884616140
Finished backup at 2015/07/09 14:42:21

4. 我們做如下操作

SQL> select sequence#, status,sysdate from  v$log;

 SEQUENCE# STATUS     SYSDATE
---------- ---------- -------------------
	 1 INACTIVE   2015/07/09 14:56:10
	 2 INACTIVE   2015/07/09 14:56:10
	 3 CURRENT    2015/07/09 14:56:10

SQL> alter system switch logfile;

System altered.

SQL> select sequence#, status,sysdate from  v$log;

 SEQUENCE# STATUS     SYSDATE
---------- ---------- -------------------
	 4 CURRENT    2015/07/09 14:57:20
	 2 INACTIVE   2015/07/09 14:57:20
	 3 ACTIVE     2015/07/09 14:57:20

SQL> insert into scott.t_tspitr_test select * from scott.t_tspitr_test;

14 rows created.

SQL> select count(*) from scott.t_tspitr_test;

  COUNT(*)
----------
	28

SQL> alter system switch logfile;

System altered.

SQL> select sequence#, status,sysdate from  v$log;

 SEQUENCE# STATUS     SYSDATE
---------- ---------- -------------------
	 4 ACTIVE     2015/07/09 14:59:11
	 5 CURRENT    2015/07/09 14:59:11
	 3 INACTIVE   2015/07/09 14:59:11

SQL>

當(dāng)恢復(fù)到日志編號(hào)為3時(shí)表中應(yīng)該有14條數(shù)據(jù)。

4. 建立輔助恢復(fù)目錄

11gdg-> mkdir /backup/aux

6.執(zhí)行恢復(fù)

RMAN> RECOVER TABLESPACE 'TSPITR' UNTIL LOGSEQ 3  AUXILIARY DESTINATION '/backup/aux';

Starting recover at 2015/07/09 15:16:06
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=47 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='nkvk'

initialization parameters used for automatic instance:
db_name=DEVDB
db_unique_name=nkvk_tspitr_DEVDB
compatible=11.2.0.0.0
db_block_size=8192
db_files=200
sga_target=280M
processes=50
db_create_file_dest=/backup/aux
log_archive_dest_1='location=/backup/aux'
#No auxiliary parameter file used


starting up automatic instance DEVDB

Oracle instance started

Total System Global Area     292278272 bytes

Fixed Size                     2227744 bytes
Variable Size                100663776 bytes
Database Buffers             184549376 bytes
Redo Buffers                   4837376 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  logseq 3 thread 1;
# 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 2015/07/09 15:16:22
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/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T144032_bsw5ycl2_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T144032_bsw5ycl2_.bkp tag=TAG20150709T144032
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/backup/aux/DEVDB/controlfile/o1_mf_bsw7y759_.ctl
Finished restore at 2015/07/09 15:16:24

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  logseq 3 thread 1;
plsql <<<-- tspitr_2
declare
  sqlstatement       varchar2(512);
  offline_not_needed exception;
  pragma exception_init(offline_not_needed, -01539);
begin
  sqlstatement := 'alter tablespace '||  '"TSPITR"' ||' offline immediate';
  krmicd.writeMsg(6162, sqlstatement);
  krmicd.execSql(sqlstatement);
exception
  when offline_not_needed then
    null;
end; >>>;
# 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/devdb/tspitr01.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

sql statement: alter tablespace "TSPITR" offline immediate

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /backup/aux/DEVDB/datafile/o1_mf_temp_%u_.tmp in control file

Starting restore at 2015/07/09 15:16:29
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 /backup/aux/DEVDB/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /backup/aux/DEVDB/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /backup/aux/DEVDB/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/devdb/tspitr01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T144032_bsw5v1cb_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T144032_bsw5v1cb_.bkp tag=TAG20150709T144032
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 2015/07/09 15:17:34

datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=884618255 file name=/backup/aux/DEVDB/datafile/o1_mf_system_bsw7yg0d_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=884618255 file name=/backup/aux/DEVDB/datafile/o1_mf_undotbs1_bsw7yg16_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=7 STAMP=884618255 file name=/backup/aux/DEVDB/datafile/o1_mf_sysaux_bsw7yg0j_.dbf

contents of Memory Script:
{
# set requested point in time
set until  logseq 3 thread 1;
# 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  "TSPITR", "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 2015/07/09 15:17:35
using channel ORA_AUX_DISK_1

starting media recovery

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=2
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_annnn_TAG20150709T144220_bsw5ydxj_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_annnn_TAG20150709T144220_bsw5ydxj_.bkp tag=TAG20150709T144220
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/backup/aux/1_2_884613136.dbf thread=1 sequence=2
channel clone_default: deleting archived log(s)
archived log file name=/backup/aux/1_2_884613136.dbf RECID=3 STAMP=884618256
media recovery complete, elapsed time: 00:00:01
Finished recover at 2015/07/09 15:17:38

database opened

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

sql statement: alter tablespace  "TSPITR" read only

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/backup/aux''

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/backup/aux''

Performing export of metadata...
   EXPDP> Starting "SYS"."TSPITR_EXP_nkvk":  
   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_nkvk" successfully loaded/unloaded
   EXPDP> ******************************************************************************
   EXPDP> Dump file set for SYS.TSPITR_EXP_nkvk is:
   EXPDP>   /backup/aux/tspitr_nkvk_59637.dmp
   EXPDP> ******************************************************************************
   EXPDP> Datafiles required for transportable tablespace TSPITR:
   EXPDP>   /u01/app/oracle/oradata/devdb/tspitr01.dbf
   EXPDP> Job "SYS"."TSPITR_EXP_nkvk" successfully completed at 15:19:40
Export completed


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

database closed
database dismounted
Oracle instance shut down

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

Removing automatic instance
shutting down automatic instance 
target database instance not started
Automatic instance removed
auxiliary instance file /backup/aux/DEVDB/datafile/o1_mf_temp_bsw80r22_.tmp deleted
auxiliary instance file /backup/aux/DEVDB/onlinelog/o1_mf_3_bsw80n92_.log deleted
auxiliary instance file /backup/aux/DEVDB/onlinelog/o1_mf_2_bsw80m9y_.log deleted
auxiliary instance file /backup/aux/DEVDB/onlinelog/o1_mf_1_bsw80lhs_.log deleted
auxiliary instance file /backup/aux/DEVDB/datafile/o1_mf_sysaux_bsw7yg0j_.dbf deleted
auxiliary instance file /backup/aux/DEVDB/datafile/o1_mf_undotbs1_bsw7yg16_.dbf deleted
auxiliary instance file /backup/aux/DEVDB/datafile/o1_mf_system_bsw7yg0d_.dbf deleted
auxiliary instance file /backup/aux/DEVDB/controlfile/o1_mf_bsw7y759_.ctl deleted
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/09/2015 15:20:10
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of sql command on default channel at 07/09/2015 15:20:10
RMAN-11003: failure during parse/execution of SQL statement: drop tablespace  "TSPITR" including contents keep datafiles
ORA-00604: error occurred at recursive SQL level 1
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

RMAN>

報(bào)錯(cuò)了~

后面經(jīng)過(guò)試驗(yàn),"RECOVER TABLESPACE 'TSPITR' UNTIL LOGSEQ 3 " 的UNTIL LOGSEQ 3并不包括日志3 。應(yīng)該將恢復(fù)語(yǔ)句改成

RECOVER TABLESPACE 'TSPITR' UNTIL LOGSEQ 4  AUXILIARY DESTINATION '/backup/aux';

 

文章標(biāo)題:Oracle學(xué)習(xí)之RMAN(十五)恢復(fù)實(shí)戰(zhàn)--TSPITR
網(wǎng)站鏈接:http://aaarwkj.com/article10/jjpddo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁(yè)設(shè)計(jì)公司、用戶(hù)體驗(yàn)虛擬主機(jī)、網(wǎng)站收錄、靜態(tài)網(wǎng)站、小程序開(kāi)發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都app開(kāi)發(fā)公司
久久久精品免费中文视频| 不卡av免费在线网址| 久久亚洲一区二区内射| 神马影院在线观看午夜| 国产黄片一区二区在线| 国产又粗又长又大无遮挡| 日日添夜夜添天天操| 精品一区二区三区女同| 香蕉视频在线观看亚洲精品| 日本道二区视频中文字幕| 免费在线一区二区av| 日韩不卡区免费在线观看| 日韩av亚洲一区二区三区| 日本免费播放一区二区视频| 中文字幕五月婷婷免费| 日韩精品一区二区三区电影在线播放 | 国产婷婷综合一区二区| 美女在线观看av少妇| 一区二区尤物区亚洲国产精品区| 日韩一区二区亚洲精品| 久久亚洲一区二区麻豆偷| 国产又猛又黄又爽无遮挡| 日韩视频在线一区二区三区| 日韩黄色资源在线观看| 亚洲精品成人午夜久久| 日本美女激情在线观看| 国产精品自偷自偷自偷| 亚洲成av人片又粗又长| 日日躁夜夜躁狠狠躁黑人| av天堂网站在线观看| 久久九九精品日本人妻视频| 日本韩国三级视频在线观看| 亚洲一区二区三区av电影| 岛国大片一区二区三区| 欧美一区二区三区日| 成人国产午夜福利网| 婷婷不卡中文字幕三区| 我想看日韩一级黄色片| 色综合av男人的天堂| 国产黄片自拍视频免费看| 午夜福利视频在线观看|