『壹』 如何導出oracle 11g中的資料庫的數據字典
-- 查詢某表的數據字典
SELECT A.TABLE_NAME AS 表名,A.COLUMN_NAME AS 欄位名,
DECODE(A.CHAR_LENGTH,0,DECODE(A.DATA_SCALE,NULL,A.DATA_TYPE,A.DATA_TYPE||'('||A.DATA_PRECISION||','||A.DATA_SCALE||')'),
A.DATA_TYPE||'('||A.CHAR_LENGTH||')') as 欄位類型1,A.DATA_TYPE AS 欄位類型,A.DATA_PRECISION AS 有效位,A.DATA_SCALE AS 精度值,
A.CHAR_LENGTH AS 欄位長度,A.NULLABLE AS 能否為空
FROM sys.user_tab_columns A where A.table_name = 'TAM_ADDRESS'
-- 具有dba許可權用戶導出數據字典
SELECT A.TABLE_NAME AS 表名,A.COLUMN_NAME AS 欄位名,
DECODE(A.CHAR_LENGTH,0,DECODE(A.DATA_SCALE,NULL,A.DATA_TYPE,A.DATA_TYPE||'('||A.DATA_PRECISION||','||A.DATA_SCALE||')'),
A.DATA_TYPE||'('||A.CHAR_LENGTH||')') as 欄位類型,A.DATA_DEFAULT AS 默認值,
A.NULLABLE AS 能否為空,B.comments AS 備注
FROM sys.all_tab_columns A,sys.DBA_COL_COMMENTS B
WHERE A.owner=B.owner AND A.table_name=B.table_name AND A.COLUMN_NAME=B.COLUMN_NAME AND A.owner='guoqiang' AND
A.TABLE_NAME IN (
'TB_SUBJECT', 'TB_SUBJECT_BALANCE', 'TB_VOUCHER', 'TB_VOUCHER_DETAILS',
'TB_CUSTOMER', 'TB_VOUCHER_CLASSIFY_MODE', 'TB_VOUCHER_TYPE', 'TB_ASSET',
'TB_ASSET_CATALOG', 'TB_M_DM_ASSETS_LIABI_RPT', 'TB_M_DM_PROFIT_RPT',
'TB_M_DM_REVENUE_RPT', 'TB_M_DM_COST_RPT')ORDER BY A.TABLE_NAME
SELECT A.TABLE_NAME AS 表名,A.COLUMN_NAME AS 欄位名,
DECODE(A.CHAR_LENGTH,0,DECODE(A.DATA_SCALE,NULL,A.DATA_TYPE,A.DATA_TYPE||'('||A.DATA_PRECISION||','||A.DATA_SCALE||')'),
A.DATA_TYPE||'('||A.CHAR_LENGTH||')') as 欄位類型,A.DATA_DEFAULT AS 默認值,
A.NULLABLE AS 能否為空,B.comments AS 備注
FROM sys.user_tab_columns A,sys.user_col_comments B
WHERE A.table_name=B.table_name AND A.COLUMN_NAME=B.COLUMN_NAME AND
A.TABLE_NAME IN (
'TB_SUBJECT', 'TB_SUBJECT_BALANCE', 'TB_VOUCHER', 'TB_VOUCHER_DETAILS',
'TB_CUSTOMER', 'TB_VOUCHER_CLASSIFY_MODE', 'TB_VOUCHER_TYPE', 'TB_ASSET',
『貳』 oracle伺服器是10g,客戶端資料庫11g,怎麼導出10g數據到本地
客戶端訪問資料庫不存在什麼沖突,導入導出工具exp可以在遠端執行,expdp需要在資料庫本地執行. 如果是要導出數據到本地11g資料庫,可以在10g伺服器用expdp到處後,確認到處過程中是用的什麼版本的expdp , 傳到11g這邊,用impdp導入,加上參數 COMPATIBLE=10.x.x.x(10g導出時可以看到的版本)