ASM後設資料備份與恢復
1.建立一個表空間
SQL> create tablespace asmtbs datafile '+dg1';
Tablespace created.
SQL> create table t (id number,name varchar2(10)) tablespace asmtbs;
Table created.
SQL> select segment_name,tablespace_name from user_segments where segment_name='T';
SEGMENT_NA TABLESPACE_NAME
---------- ------------------------------
T ASMTBS
3.備份ASM後設資料
[oracle@ocp ~]$ dd if=/dev/oracleasm/disks/VOL1 of=/home/oracle/vol1.bak bs=4096 count=1
1+0 records in
1+0 records out
4.破壞ASM後設資料
[oracle@ocp ~]$ dd if=/dev/zero of=/dev/oracleasm/disks/VOL1 bs=4096 count=1
1+0 records in
1+0 records out
[oracle@ocp ~]$ kfed read /dev/oracleasm/disks/VOL1 --後設資料被破壞
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 0 ; 0x001: 0x00
kfbh.type: 0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt: 0 ; 0x003: 0x00
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: 0 ; 0x008: TYPE=0x0 NUMB=0x0
kfbh.check: 0 ; 0x00c: 0x00000000
kfbh.fcn.base: 0 ; 0x010: 0x00000000
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
5.插入資料
SQL> select * from t;
no rows selected
SQL> insert into t values(1,'a');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t;
ID NAME
---------- ------------------------------------------------------------
1 a
6.關閉資料庫例項和ASM例項
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> select status from v$instance;
STATUS
------------
STARTED
SQL> shutdown immediate; --關閉ASM例項
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup --啟動ASM例項
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
SQL> alter diskgroup dg1 mount; --掛載磁碟組
alter diskgroup dg1 mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DG1"
7.恢復
[oracle@ocp ~]$ dd if=/home/oracle/vol1.bak of=/dev/oracleasm/disks/VOL1 bs=4096 count=1
1+0 records in
1+0 records out
SQL> alter diskgroup dg1 mount; --磁碟組mount成功
Diskgroup altered.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 117442128 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
資料庫也能正常啟動
SQL> create tablespace asmtbs datafile '+dg1';
Tablespace created.
沒有指定大小,預設建立100m.
SQL> select * from v$dbfile;
FILE# NAME
---------- ------------------------------------------------------------
4 /u01/app/oracle/oradata/test/users01.dbf
3 /u01/app/oracle/oradata/test/sysaux01.dbf
2 /u01/app/oracle/oradata/test/undotbs01.dbf
1 /u01/app/oracle/oradata/test/system01.dbf
5 /u01/app/oracle/oradata/test/test01.dbf
6 /u01/app/oracle/oradata/test/mgmt.dbf
7 /u01/app/oracle/oradata/test/mgmt_ecm_depot1.dbf
8 +DG1/test/datafile/asmtbs.256.891217415
8 rows selected.
2.在表空間建立一張表SQL> select * from v$dbfile;
FILE# NAME
---------- ------------------------------------------------------------
4 /u01/app/oracle/oradata/test/users01.dbf
3 /u01/app/oracle/oradata/test/sysaux01.dbf
2 /u01/app/oracle/oradata/test/undotbs01.dbf
1 /u01/app/oracle/oradata/test/system01.dbf
5 /u01/app/oracle/oradata/test/test01.dbf
6 /u01/app/oracle/oradata/test/mgmt.dbf
7 /u01/app/oracle/oradata/test/mgmt_ecm_depot1.dbf
8 +DG1/test/datafile/asmtbs.256.891217415
8 rows selected.
SQL> create table t (id number,name varchar2(10)) tablespace asmtbs;
Table created.
SQL> select segment_name,tablespace_name from user_segments where segment_name='T';
SEGMENT_NA TABLESPACE_NAME
---------- ------------------------------
T ASMTBS
3.備份ASM後設資料
[oracle@ocp ~]$ dd if=/dev/oracleasm/disks/VOL1 of=/home/oracle/vol1.bak bs=4096 count=1
1+0 records in
1+0 records out
4.破壞ASM後設資料
[oracle@ocp ~]$ dd if=/dev/zero of=/dev/oracleasm/disks/VOL1 bs=4096 count=1
1+0 records in
1+0 records out
[oracle@ocp ~]$ kfed read /dev/oracleasm/disks/VOL1 --後設資料被破壞
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 0 ; 0x001: 0x00
kfbh.type: 0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt: 0 ; 0x003: 0x00
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: 0 ; 0x008: TYPE=0x0 NUMB=0x0
kfbh.check: 0 ; 0x00c: 0x00000000
kfbh.fcn.base: 0 ; 0x010: 0x00000000
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
5.插入資料
SQL> select * from t;
no rows selected
SQL> insert into t values(1,'a');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t;
ID NAME
---------- ------------------------------------------------------------
1 a
6.關閉資料庫例項和ASM例項
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> select status from v$instance;
STATUS
------------
STARTED
SQL> shutdown immediate; --關閉ASM例項
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup --啟動ASM例項
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
SQL> alter diskgroup dg1 mount; --掛載磁碟組
alter diskgroup dg1 mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DG1"
7.恢復
[oracle@ocp ~]$ dd if=/home/oracle/vol1.bak of=/dev/oracleasm/disks/VOL1 bs=4096 count=1
1+0 records in
1+0 records out
SQL> alter diskgroup dg1 mount; --磁碟組mount成功
Diskgroup altered.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 117442128 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
資料庫也能正常啟動
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26937943/viewspace-1813431/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【ASM】ASMCMD 磁碟後設資料的備份與恢復實踐ASM
- 備份與恢復:polardb資料庫備份與恢復資料庫
- 【備份恢復】Oracle 資料備份與恢復微實踐Oracle
- Mysql資料備份與恢復MySql
- 【備份恢復】從備份恢復資料庫資料庫
- 資料庫備份與恢復(使用歸檔後滾)資料庫
- postgresql備份與恢復資料庫SQL資料庫
- mongo資料庫備份與恢復Go資料庫
- Redis的資料備份與恢復Redis
- 資料庫的備份與恢復資料庫
- Informix資料庫備份與恢復ORM資料庫
- ASMCMD執行ASM後設資料備份與還原ASM
- 備份與恢復--從備份的歸檔日誌中恢復資料
- Oracle資料庫備份與恢復之三:OS備份/使用者管理的備份與恢復Oracle資料庫
- oracle rac 在asm下的備份與恢復OracleASM
- 【備份恢復】資料恢復指導資料恢復
- Oracle資料泵的備份與恢復Oracle
- mysql的資料庫備份與恢復MySql資料庫
- oracle資料庫的備份與恢復Oracle資料庫
- 資料庫備份與恢復技術資料庫
- 備份與恢復--重建控制檔案後資料檔案損壞的恢復
- 資料庫備份與異機恢復——熱備份方式資料庫
- Oracle備份與恢復【丟失資料檔案的恢復】Oracle
- 【備份恢復】noarchive模式下使用增量備份恢復資料庫Hive模式資料庫
- rman資料庫全庫備份與恢復資料庫
- Oracle資料庫備份與恢復之RMANOracle資料庫
- 關閉資料庫的備份與恢復資料庫
- Oracle資料庫的備份與恢復(轉)Oracle資料庫
- 資料庫備份與恢復----第一課資料庫
- Oracle 資料庫的備份與恢復(轉)Oracle資料庫
- MySQL備份與恢復——基於Xtrabackup物理備份恢復MySql
- 備份與恢復--利用備份的控制檔案恢復
- 【備份恢復】無備份線上恢復非關鍵資料檔案
- 備份與恢復系列 十一 控制檔案的備份與恢復
- 備份與恢復:Polardb資料庫資料基於時間點恢復資料庫
- Votingdisk, OCR, ASM 相關資訊及備份與恢復ASM
- Postgresql 備份與恢復SQL
- MySQL備份與恢復MySql