利用dd命令實現raw db到file系統db的轉換!
下面檔案raw_convert_fs.sql 中記錄的是一個raw db到file系統db的大致過程!
[oracle@xys orcl]$ more raw_convert_fs.sql
SQL> !
SQL> @ dbf.sql
FILE_NAME BYTES TABLESPACE BLOCKS BYTES+BYTES/BLOCKS
---------------- ---------- ---------- ---------- ------------------
/dev/raw/raw1 314572800 SYSTEM 38400 314580992
/dev/raw/raw3 157286400 UNDOTBS1 19200 157294592
/dev/raw/raw2 125829120 SYSAUX 15360 125837312
/dev/raw/raw6 5242880 USERS 640 5251072
/dev/raw/raw14 5242880 TRANS 640 5251072
SQL> ! dd if=/dev/raw/raw14 of=trans.dbf bs=8k count=641
SQL> !
SQL> spool raw_convert_fs.sql append
SQL> ! dd if=/dev/raw/raw6 of=users01.dbf bs=8k count=641
SQL> ! dd if=/dev/raw/raw2 of=sysaux01.dbf bs=8k count=15361
SQL> @ dbf.sql
FILE_NAME BYTES TABLESPACE BLOCKS BYTES+BYTES/BLOCKS
---------------- ---------- ---------- ---------- ------------------
/dev/raw/raw1 314572800 SYSTEM 38400 314580992
/dev/raw/raw3 157286400 UNDOTBS1 19200 157294592
/dev/raw/raw2 125829120 SYSAUX 15360 125837312
/dev/raw/raw6 5242880 USERS 640 5251072
/dev/raw/raw14 5242880 TRANS 640 5251072
SQL> ! dd if=/dev/raw/raw3 of=undotbs01.dbf bs=8k count=19201
SQL> ! dd if=/dev/raw/raw1 of=system01.dbf bs=8k count=38401
SQL> desc v$controlfile;
Name Null? Type
----------------------------------------- -------- ----------------------------
STATUS VARCHAR2(7)
NAME VARCHAR2(513)
IS_RECOVERY_DEST_FILE VARCHAR2(3)
BLOCK_SIZE NUMBER
FILE_SIZE_BLKS NUMBER
SQL> select name , block_size , file_size_blks from v$controlfile;
NAME
--------------------------------------------------------------------------------
BLOCK_SIZE FILE_SIZE_BLKS
---------- --------------
/dev/raw/raw7
16384 430
/dev/raw/raw8
16384 430
SQL> col name format a20
SQL> select name , block_size , file_size_blks from v$controlfile;
NAME BLOCK_SIZE FILE_SIZE_BLKS
-------------------- ---------- --------------
/dev/raw/raw7 16384 430
/dev/raw/raw8 16384 430
SQL> ! dd if=/dev/raw/raw7 of=control01.ctl bs=16k count=430
SQL> ! dd if=/dev/raw/raw8 of=control02.ctl bs=16k count=430
SQL> host pwd
SQL> host pwd ls -l
SQL> host ls -l
SQL> desc v$logfile;
Name Null? Type
----------------------------------------- -------- ----------------------------
GROUP# NUMBER
STATUS VARCHAR2(7)
TYPE VARCHAR2(7)
MEMBER VARCHAR2(513)
IS_RECOVERY_DEST_FILE VARCHAR2(3)
SQL> col member format a20
SQL> select member , bytes/512 from v$logfile;
select member , bytes/512 from v$logfile
*
ERROR at line 1:
ORA-00904: "BYTES": invalid identifier
SQL> select member from v$logfile;
MEMBER
--------------------
/dev/raw/raw9
/dev/raw/raw10
/dev/raw/raw11
SQL> select bytes/512 from v$log;
BYTES/512
----------
20480
20480
20480
SQL> select bytes/1024/512 from v$log;
BYTES/1024/512
--------------
20
20
20
SQL> select distinct block_size from v$archived_log;
BLOCK_SIZE
----------
512
SQL> ! dd if=/dev/raw/raw9 of=redo01.log bs=512k count=20
SQL> select member from v$logfile;
MEMBER
--------------------
/dev/raw/raw9
/dev/raw/raw10
/dev/raw/raw11
SQL> ! dd if=/dev/raw/raw10 of=redo02.log bs=512k count=20
SQL> ! dd if=/dev/raw/raw11 of=redo03.log bs=512k count=20
SQL> create pfile from spfile;
File created.
--=============================
raw db下各類檔案如下:
[oracle@xys orcl]$ sqlplus as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 2 22:40:40 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> col file_name fromat a50
SP2-0158: unknown COLUMN option "fromat"
SQL> col file_name format a50
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------
/opt/app/oracle/oradata/orcl/system01.dbf
/opt/app/oracle/oradata/orcl/undotbs01.dbf
/opt/app/oracle/oradata/orcl/sysaux01.dbf
/opt/app/oracle/oradata/orcl/users01.dbf
/opt/app/oracle/oradata/orcl/trans.dbf
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/opt/app/oracle/oradata/orcl/control01.ctl
/opt/app/oracle/oradata/orcl/control02.ctl
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/opt/app/oracle/oradata/orcl/redo01.log
/opt/app/oracle/oradata/orcl/redo02.log
/opt/app/oracle/oradata/orcl/redo03.log
SQL>
轉化之後db_name並沒有發生變化,因此要想在同一臺os上啟動轉化後的db,需要建立bdump,cdump,udmp等各類檔案以及需要編輯引數檔案建立口令檔案。
轉換為檔案系統 db各類檔案如下:
SQL> connect as sysdba
Connected.
SQL> col file_name format a50
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------
/opt/app/oracle/oradata/orcl/system01.dbf
/opt/app/oracle/oradata/orcl/undotbs01.dbf
/opt/app/oracle/oradata/orcl/sysaux01.dbf
/opt/app/oracle/oradata/orcl/users01.dbf
/opt/app/oracle/oradata/orcl/trans.dbf
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/opt/app/oracle/oradata/orcl/control01.ctl
/opt/app/oracle/oradata/orcl/control02.ctl
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/opt/app/oracle/oradata/orcl/redo01.log
/opt/app/oracle/oradata/orcl/redo02.log
/opt/app/oracle/oradata/orcl/redo03.log
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/19602/viewspace-1008367/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 利用 DB 實現分散式鎖的思路分散式
- db file scattered read與事件db file sequential read相類似(轉)事件
- 恢復rac db(raw)到單例項下單例
- db file parallel writeParallel
- oracle 修改archive的地址到db_recovery_file_destOracleHive
- 解決db file sequential read與db file scattered read
- whereRaw 與 where (\DB::raw ()) 的區別
- 利用DB Link實現資料庫間的表同步資料庫
- 利用LangGraph和Waii實現你的chat2db!AI
- Oracle:db file scattered readOracle
- The Db2 Recovery History FileDB2
- 事件:db file scattered read事件
- 遷移檔案系統管理下的db到asm下ASM
- 等待事件db file sequential read、db file scattered read和direct read的區別事件
- 記 DB::raw () 查詢 及 collection 的 pluck () 方法
- 學習 DB2LOOK 命令(轉)DB2
- GaussDB: db2->gaussdb 函式轉換DB2函式
- DB2實用命令總結DB2
- 常用的DB2命令DB2
- db file scattered read等待事件事件
- db file sequential read等待事件事件
- 【等待事件】db file sequential read事件
- 【等待事件】db file scattered read事件
- db file sequential read 詳解
- 等待事件--db file scattered reads事件
- 等待事件--db file sequential reads事件
- db file sequential read事件的發生事件
- 轉eygle大師_wait event_db file init writeAI
- 非空閒等待事件之:db file scattered read(轉)事件
- db2move和幾個常用的db2命令DB2
- DB2LOOK 命令DB2
- tatspack之十二-db file scattered read-DB檔案分散讀取
- DB2環境部署-在DB2UDBV8.1中使用裸裝置(raw)DB2
- db file sequential read及優化優化
- 常用的DB2管理命令DB2
- DB2中export命令詳解<<轉載>>DB2Export
- 消除11.2上的db file parallel readParallel
- data file int write和db file sequential read個人想法