更新
您的更新语句将无法正常工作。正确的语法是
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