python實現oracle資料泵匯出功能
指令碼如下:
[oracle@ycr python]$ more dump.py
#/usr/bin/python
#coding:utf8
import sys
import os
import time
nowt=time.strftime('%Y%m%d%H',time.localtime())
excmd='expdp %s/%s@%s directory=YCRDUMP dumpfile=ycrdump%s.dmp' % (sys.argv[1],sys.argv[2],sys.argv[3],nowt)
result=os.system(excmd)
測試結果如下:
[oracle@ycr python]$ python dump.py test oracle ycr2 ---------三個引數分別為,使用者名稱test,密碼oracle和連線字串ycr2
Export: Release 12.1.0.2.0 - Production on Wed Aug 3 02:52:00 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Starting "TEST"."SYS_EXPORT_SCHEMA_01": test/********@ycr2 directory=YCRDUMP dumpfile=ycrdump2016080302.dmp
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 128 KB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
. . exported "TEST"."T2" 16.78 KB 4 rows
. . exported "TEST"."T3" 12.21 KB 3 rows
. . exported "TEST"."T1" 0 KB 0 rows
Master table "TEST"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for TEST.SYS_EXPORT_SCHEMA_01 is:
/u01/app/oracle/ycrdump2016080302.dmp
Job "TEST"."SYS_EXPORT_SCHEMA_01" successfully completed at Wed Aug 3 02:52:46 2016 elapsed 0 00:00:44
[oracle@ycr python]$ more dump.py
#/usr/bin/python
#coding:utf8
import sys
import os
import time
nowt=time.strftime('%Y%m%d%H',time.localtime())
excmd='expdp %s/%s@%s directory=YCRDUMP dumpfile=ycrdump%s.dmp' % (sys.argv[1],sys.argv[2],sys.argv[3],nowt)
result=os.system(excmd)
測試結果如下:
[oracle@ycr python]$ python dump.py test oracle ycr2 ---------三個引數分別為,使用者名稱test,密碼oracle和連線字串ycr2
Export: Release 12.1.0.2.0 - Production on Wed Aug 3 02:52:00 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Starting "TEST"."SYS_EXPORT_SCHEMA_01": test/********@ycr2 directory=YCRDUMP dumpfile=ycrdump2016080302.dmp
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 128 KB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
. . exported "TEST"."T2" 16.78 KB 4 rows
. . exported "TEST"."T3" 12.21 KB 3 rows
. . exported "TEST"."T1" 0 KB 0 rows
Master table "TEST"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for TEST.SYS_EXPORT_SCHEMA_01 is:
/u01/app/oracle/ycrdump2016080302.dmp
Job "TEST"."SYS_EXPORT_SCHEMA_01" successfully completed at Wed Aug 3 02:52:46 2016 elapsed 0 00:00:44
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29135257/viewspace-2122885/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle資料泵的匯入和匯出Oracle
- Oracle資料泵匯出匯入(expdp/impdp)Oracle
- Oracle expdp資料泵遠端匯出Oracle
- Oracle使用資料泵expdp,impdp進行資料匯出匯入Oracle
- 資料泵匯出匯入
- 【資料泵】EXPDP匯出表結構(真實案例)
- Oracle資料庫——資料匯出時出現匯出成功終止, 但出現警告。Oracle資料庫
- 運維中資料泵匯出常用的細節小功能兩例運維
- Oracle資料匯入匯出Oracle
- Oracle 資料匯入匯出Oracle
- 資料泵匯出匯入物化檢視(ORA-39083)
- oracle10g expdp資料泵的bug,按schema匯出,匯入impdp時無jobOracle
- 分享運維中資料泵匯出常用的細節小功能兩例運維
- Python 基於 xlsxwriter 實現百萬資料匯出 excelPythonExcel
- oracle資料匯出匯入(exp/imp)Oracle
- 前端實現Excel匯入和匯出功能前端Excel
- 細緻入微:如何使用資料泵匯出表的部分列資料
- Oracle用資料泵匯入資料包12899的錯誤碼解決方法Oracle
- EasyPoi 多sheet匯出功能實現
- QZpython匯入匯出redis資料的實現deuPythonRedis
- Oracle 資料匯出注意事項Oracle
- Oracle資料泵(Oracle Data Pump) 19cOracle
- ORACLE 資料泵impdp匯入報錯之ORA-31693 ORA-04098Oracle
- vue匯出excel資料表格功能VueExcel
- Oracle資料庫匯入匯出。imp匯入命令和exp匯出命令Oracle資料庫
- oracle 備份資料庫,匯出資料庫Oracle資料庫
- Oracle資料庫(資料泵)遷移方案(上)Oracle資料庫
- Oracle資料庫(資料泵)遷移方案(下)Oracle資料庫
- Oracle匯出資料庫與還原Oracle資料庫
- python 小指令碼 (實現 elasticsearch 匯出匯入)Python指令碼Elasticsearch
- React專案實現匯出PDF的功能React
- oracle邏輯備份之--資料泵Oracle
- 【ASK_ORACLE】重灌Oracle資料泵(Datapump)工具的方法Oracle
- oracle按照表條件expdp匯出資料Oracle
- oracle12c還原資料庫遇到的問題-將一個11.2.0.1的資料泵匯出檔案匯入12.1.0.2版本報錯Oracle資料庫
- SpringCloud微服務實戰——搭建企業級開發框架(三十):整合EasyExcel實現資料表格匯入匯出功能SpringGCCloud微服務框架Excel
- Vue通過Blob物件實現匯出Excel功能Vue物件Excel
- mysql mysqldump只匯出表結構或只匯出資料的實現方法MySql
- 【最佳實踐】MongoDB匯出匯入資料MongoDB