dataguard mysql,[dataguard同步数据库]Dataguard环境下数据库的备份与恢复
在線QQ客服:1922638
專業(yè)的SQL Server、MySQL數(shù)據(jù)庫同步軟件
在部署完active data guard后,不但可以將只讀的查詢交給備庫執(zhí)行,還可以把日常的數(shù)據(jù)庫備份工作放在備庫上執(zhí)行,從而減輕主庫的壓力,充分的發(fā)揮服務(wù)器資源,下面演示下利用備庫備份來還原主庫數(shù)據(jù)的過程!
一:主庫上創(chuàng)建表空間,并在表空間上建表,插入測試數(shù)據(jù),同時檢查備庫的同步情況
SQL> create tablespace test01 datafile ‘/u01/app/Oracle/oradata/db1/test01.dbf’ size 10M;
Tablespace created.
SQL> create table rman tablespace test01 as select object_id,object_name from dba_objects;
Table created.
SQL> select count(*) from rman;
COUNT(*)
———-
76379
[oracle@db2 db1]$ sqlplus/nolog
SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 29 11:37:38 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> conn/as sysdba
Connected.
SQL> select count(*) from rman;
COUNT(*)
———-
76379
二:在備庫上使用rman對新建的表空間test01進行備份
[oracle@db2 db1]$ rman target/
Recovery Manager: Release 11.2.0.3.0-Production on Mon Oct 29 11:38:01 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: DB1 (DBID=1387827106)
RMAN> report schema;
RMAN> backup tablespace test01 format ‘/home/oracle/test01_%U’;
Starting backup at 2012-10-29-11:38:50
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00034 name=/u01/app/oracle/oradata/db1/test01.dbf
channel ORA_DISK_1: starting piece 1 at 2012-10-29-11:38:51
channel ORA_DISK_1: finished piece 1 at 2012-10-29-11:38:52
piece handle=/home/oracle/test01_03novc2b_1_1 tag=TAG20121029T113851 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2012-10-29-11:38:52
三:關(guān)閉主庫后刪除表空間數(shù)據(jù)文件,模擬數(shù)據(jù)丟失場景
[oracle@db1 ~]$ sqlplus/nolog
SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 29 11:39:49 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> conn/as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
[oracle@db1 ~]$ rm-rf/u01/app/oracle/oradata/db1/test01.dbf
四:重新啟動主庫,只能啟動到mount狀態(tài)
[oracle@db1 ~]$ sqlplus/nolog
SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 29 11:41:42 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> conn/as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1536602112 bytes
Fixed Size 2228624 bytes
Variable Size 1174408816 bytes
Database Buffers 352321536 bytes
Redo Buffers 7643136 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 34-see DBWR trace file
ORA-01110: data file 34: ‘/u01/app/oracle/oradata/db1/test01.dbf’
SQL> select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
————————————
MOUNTED PRIMARY
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的dataguard mysql,[dataguard同步数据库]Dataguard环境下数据库的备份与恢复的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: rootfs 制作ubuntu_Ubun
- 下一篇: Mysql的MVCC是什么