更新
您的更新語句將無法正常工作。正確的語法是
update employee
set ELIGIBILITY = 'N'
where DEPT_ID IN ('INS', 'BAN', 'AUT');
插入,因爲甲骨文公司擁有的東西,被稱爲臨時表但你可能不使用臨時表,因爲在這種情況下,您的數據
一個臨時表聽起來很奇怪在您註銷後會丟失。所以我們稱之爲輔助表。
CREATE TABLE auxtable
...
)
NOLOGGING;
將創建一個有資格進行nologging操作的表。但只有在表空間或甚至整個數據庫處於強制日誌記錄模式下。
現在只用一個INSERT語句來插入數據 - 它必須提供相應的數據:
INSERT /*+APPEND */ INTO AUXTABLE(
EMPNO,
FIRST_NAME,
LAST_NAME,
SALARY,
HIREDATE,
DEPT_ID,
ELIGIBILITY)
SELECT
EMPNO,
FIRST_NAME,
LAST_NAME,
SALARY,
HIREDATE,
DEPT_ID,
DECODE(DEPT_ID,
'INS', 'N',
'BAN', 'N',
'AUT', 'N',
ELIGIBILITY
)
FROM EMPLOYEE;
APPEND提示建議甲骨文做插入NOLOGGING模式,如果這是在桌子上啓用。
指數
創建了索引之後,你應該chnage指數
ALTER INDEX {new_index} NOPARALLEL;
,或者在源表中的索引使用值的並列分句。
您可以使用圖形工具(如Oracle Grid Control或SQL Developer)生成提取表的sql,也可以使用expdp/impdp生成sqlfile。
$ expdp myuser content=metadata_only tables=myuser.MYTABLE DUMPFILE='mydump.dp'
Export: Release 11.2.0.4.0 - Production on Sun Jan 01 01:00:00 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "MYUSER"."SYS_EXPORT_TABLE_01": myuser/******** content=metadata_only tables=myuser.MYTABLE DUMPFILE=mydump.dp
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Master table "MYUSER"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for MYUSER.SYS_EXPORT_TABLE_01 is:
/mypath/mydump.dp
$ impdp myuser sqlfile=mytable.sql tables=myuser.MYTABLE DUMPFILE='mydump.dp'
Import: Release 11.2.0.4.0 - Production on Sun Jan 01 01:00:10 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "MYUSER"."SYS_SQL_FILE_TABLE_01" successfully loaded/unloaded
Starting "MYUSER"."SYS_SQL_FILE_TABLE_01": myuser/******** sqlfile=mytable.sql tables=myuser.MYTABLE DUMPFILE=mydump.dp
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "MYUSER"."SYS_SQL_FILE_TABLE_01" successfully completed at Sun Jan 01 01:00:15 2017 elapsed 0 00:00:05
The Sqlfile will be here:
/mypath/mytable.sql
你預計有多少行會被改變?表格(GB)有多大?爲什麼更新需要24小時纔會出現問題? – miracle173