通過shell解析dump生成parfile
[ora11g@rac1 dbm_lite]$ exp n1/n1 file=n1_ddl.dmp rows=n statistics=none
Export: Release 11.2.0.3.0 - Production on Tue Aug 26 07:21:57 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
Note: table data (rows) will not be exported
About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user N1
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user N1
About to export N1's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export N1's tables via Conventional Path ...
. . exporting table BIG_INSERT
. . exporting table BIG_INSERT_EXT2
. . exporting table CLOB_TEST
. . exporting table CLOB_TEST_EXT2
. . exporting table DATA
. . exporting table NEW_DATA
. . exporting table OLD_DATA
. . exporting table PAR_DATA
. . exporting table RATED_EVENT
. . exporting table SMALL_INSERT
. . exporting table SMALL_INSERT_EXT2
. . exporting table T
. . exporting table T1
. . exporting table T2
. . exporting table TEMP_TEST
. . exporting table TEMP_TEST_EXT2
. . exporting table TEST
. . exporting table TEST_DATA
. . exporting table TEST_DATA_EXT2
. . exporting table TEST_EXT2
. . exporting table TT
. . exporting table TTT
. . exporting table TT_EXT2
. . exporting table T_EXT2
. . exporting table T_TEMP
. . exporting table T_TEMP_EXT2
. . exporting table WIN_LIST
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
但是很多時候我們都因為是dump檔案,感覺一下子沒有了方向。無從查起。
如果我們能夠得到dump檔案中的table列表,那就太好了,我們可以很安全的進行資料的操作。不會稀裡糊塗的把一些“未知”操作避免。
如果要解析dump檔案,之前分享過一篇日誌,通過awk來解析dump檔案,得到對應的sql語句,現在來通過一些簡單的命令解析dump檔案。
我簡單測試過百兆,數十G的dump檔案,這個命令的速度都還可以,
首先,我們得到一個比較粗略的table list
[ora11g@rac1 dbm_lite]$ strings n1_ddl.dmp|grep "CREATE TABLE"|awk '{print $3}'
"BIG_INSERT"
"CLOB_TEST"
"DATA"
"NEW_DATA"
"OLD_DATA"
"PAR_DATA"
"RATED_EVENT"
"SMALL_INSERT"
"T"
"T1"
"T2"
"TEMP_TEST"
"TEST"
"TEST_DATA"
"TT"
"TTT"
"T_TEMP"
"WIN_LIST"
得到的內容如上所示,我們需要去除雙引號,然後加入tables=,每行末尾加入一個逗號。
先去掉雙引號
[ora11g@rac1 dbm_lite]$ strings n1_ddl.dmp|grep "CREATE TABLE"|awk '{print $3}'|sed 's/"//g'
BIG_INSERT
CLOB_TEST
DATA
NEW_DATA
OLD_DATA
PAR_DATA
RATED_EVENT
SMALL_INSERT
T
T1
T2
TEMP_TEST
TEST
TEST_DATA
TT
TTT
T_TEMP
WIN_LIST
然後再次判斷,如果是第一行就加入字首tables=,否則加入字首一個逗號,這樣就不用麻煩的判斷最後一行的逗號是不是要加了。
[ora11g@rac1 dbm_lite]$ strings n1_ddl.dmp|grep "CREATE TABLE"|awk '{print $3}'|sed 's/"//g'|awk '{ if(FNR==1) print "tables="$1 ; else print ","$1}'
tables=BIG_INSERT
,CLOB_TEST
,DATA
,NEW_DATA
,OLD_DATA
,PAR_DATA
,RATED_EVENT
,SMALL_INSERT
,T
,T1
,T2
,TEMP_TEST
,TEST
,TEST_DATA
,TT
,TTT
,T_TEMP
,WIN_LIST
簡單驗證一下,可以看到匯出的資訊很“乾淨”,我們在資料匯入的時候也可以做類似的操作。
[ora11g@rac1 dbm_lite]$ exp n1/n1 file=a.dmp parfile=a.par rows=n statistics=none
Export: Release 11.2.0.3.0 - Production on Tue Aug 26 07:34:19 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
Note: table data (rows) will not be exported
About to export specified tables via Conventional Path ...
. . exporting table BIG_INSERT
. . exporting table CLOB_TEST
. . exporting table DATA
. . exporting table NEW_DATA
. . exporting table OLD_DATA
. . exporting table PAR_DATA
. . exporting table RATED_EVENT
. . exporting table SMALL_INSERT
. . exporting table T
. . exporting table T1
. . exporting table T2
. . exporting table TEMP_TEST
. . exporting table TEST
. . exporting table TEST_DATA
. . exporting table TT
. . exporting table TTT
. . exporting table T_TEMP
. . exporting table WIN_LIST
Export terminated successfully without warnings.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23718752/viewspace-1258482/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 高通進dump和抓取解析dump log
- 通過用shellcode獲取shell
- [ Shell ] 通過 Shell 指令碼匯出 CDL 網表指令碼
- [ Shell ] 通過 Shell 指令碼匯出 GDSII/OASIS 檔案指令碼
- 通過shell指令碼防止埠掃描指令碼
- 通過shell指令碼 批量新增使用者指令碼
- 通過git shell 在Github上傳本地專案Github
- 通過shell指令碼批量操作mysql資料庫指令碼MySql資料庫
- 通過類名動態生成物件物件
- Intellij IDEA 通過資料庫生成 POJOIntelliJIdea資料庫POJO
- 通過ICMP協議反彈SHELL並執行命令協議
- 通過shell指令碼檢測MySQL服務資訊指令碼MySql
- Shell解析引數
- Oracle redo解析之-2、BBED & DUMP工具使用Oracle Redo
- shell生成測試資料
- 使用json通過telegraf生成metrics(摘自telegraf github文件)JSONGithub
- 通過 shell 指令碼完成 GitLab11.9.11 的一鍵安裝指令碼Gitlab
- core dump如何解決排查的過程
- dump檔案解析之探索.Net的記憶體記憶體
- 詳解Dart中如何通過註解生成程式碼Dart
- 通過實體類生成 mysql 的建表語句MySql
- 案例:通過shell指令碼實現mysql資料備份與清理指令碼MySql
- Linux通過Shell指令碼命令修改密碼不需要互動Linux指令碼密碼
- SpringBoot介面 - 如何生成介面文件之非侵入方式(通過註釋生成)Smart-Doc?Spring Boot
- dotnet獨立打包 如何設定崩潰自動生成dump
- oracle資料庫瘋狂生成dump把目錄撐滿Oracle資料庫
- mysql dump 拉取遠端資料同步到本地庫的shell 指令碼MySql指令碼
- 深入理解原型模式 ——通過複製生成例項原型模式
- C#通過java生成的RSA公鑰加密和解密C#Java加密解密
- 記一次通過 Resource 遞迴生成樹的方案遞迴
- 生成帶二維碼圖片並通過微信分享
- 通過WordCount解析Spark RDD內部原始碼機制Spark原始碼
- JAVA 通過jsonpath解析懂車帝詳情頁介面JavaJSON
- shell一文入門通
- 容器中的 .net core應用,生成dump檔案並匯出
- 如何在 NET 程式萬種死法中有效的生成 Dump (下)
- 如何在 NET 程式萬種死法中有效的生成 Dump (上)
- Lab_1:練習1——理解通過make生成執行檔案的過程
- PostgreSQL邏輯備份pg_dump使用及其原理解析SQL