oracle管理之 table(server.102 b14231)
b14231/15 manage table
Table Compression 用於只讀表提高io效能,減少cache
NOLOGGING 用於create table as select /ctas
Parallelizing 用於ctas 多處理器的情形
--臨時表,對所有session可見,不過資料只對session可見
CREATE GLOBAL TEMPORARY TABLE transaction-specific (the default) or session-specific,
DELETE ROWS transaction-specific
PRESERVE ROWS session-specific
--事務級的臨時表
CREATE GLOBAL TEMPORARY TABLE admin_work_area
(startdate DATE,
enddate DATE,
class CHAR(20))
ON COMMIT DELETE ROWS;--transaction-specific
--臨時表的內容,是由INSERT觸發的,並分配segment如果沒有insert,臨時表是沒有資料的;臨時表上可以建立index;沒有session邦定臨時表時才可以drop臨時表
--Parallelizing
ALTER SESSION FORCE PARALLEL DDL
A PARALLEL clause is included in the CREATE TABLE...AS SELECT statement
--例如
CREATE TABLE hr.admin_emp_dept
PARALLEL COMPRESS
AS SELECT * FROM hr.employees
WHERE department_id = 10;
--大容量操作,記錄錯誤記錄,避免大容量回滾誤時誤事
EXECUTE DBMS_ERRLOG.CREATE_ERROR_LOG('AAATTT', 'ERR_AAATTT');
INSERT INTO AAATTT(ID,NAME)
VALUES( '222222','22')
LOG ERRORS INTO ERR_AAATTT ('daily_load') REJECT LIMIT 25;
select t.*, t.rowid from err_aaattt t;
create table AAATTT
(
ID CHAR(5) not null,
NAME CHAR(10),
NOTE CHAR(30),
XINGMING VARCHAR2(10),
XINGM VARCHAR2(10),
NUM NUMBER(5,3),
NUM2 NUMBER(4),
NUM3 NUMBER(*,3),
DAT DATE,
TIMLZ TIMESTAMP(6) WITH LOCAL TIME ZONE,
TIMZ TIMESTAMP(6) WITH TIME ZONE,
CONSTRAIT PK_AAATTT PRIMARY KEY (ID)
)
--對應的error table為 err_aaattt
create table ERR_AAATTT
(
ORA_ERR_NUMBER$ NUMBER,
ORA_ERR_MESG$ VARCHAR2(2000),
ORA_ERR_ROWID$ UROWID(4000),
ORA_ERR_OPTYP$ VARCHAR2(2),
ORA_ERR_TAG$ VARCHAR2(2000),
ID VARCHAR2(4000),
NAME VARCHAR2(4000),
NOTE VARCHAR2(4000),
XINGMING VARCHAR2(4000),
XINGM VARCHAR2(4000),
NUM VARCHAR2(4000),
NUM2 VARCHAR2(4000),
NUM3 VARCHAR2(4000),
DAT VARCHAR2(4000),
TIMLZ VARCHAR2(4000),
TIMZ VARCHAR2(4000)
)
--Inserting Data Into Tables Using Direct-Path INSERT 是在high-water mark之上insert data,而不是使用hwm下面的free space
ALTER TABLE hr.admin_emp MOVE
STORAGE ( INITIAL 20K
NEXT 40K
MINEXTENTS 2
MAXEXTENTS 20
PCTINCREASE 0 );
ALTER TABLE hr.admin_emp DROP (bonus, commission);
ALTER TABLE hr.admin_emp RENAME COLUMN comm TO commission;
ALTER TABLE hr.admin_emp ADD (bonus NUMBER (7,2));
ALTER TABLE hr.admin_emp SET UNUSED (hiredate, mgr);
ALTER TABLE...DROP UNUSED COLUMNS
--表線上重新定義;額外需要待重新定義的表的空間大小
DBMS_REDEFINITION by primary key or by rowid(iot除外)
CAN_REDEF_TABLE
alter session force parallel dml parallel degree-of-parallelism;
alter session force parallel query parallel degree-of-parallelism;
START_REDEF_TABLE
ABORT_REDEF_TABLE
COPY_TABLE_DEPENDENTS
FINISH_REDEF_TABLE
ALTER TABLE table_name SET UNUSED (M_ROW$$);
DBA_REDEFINITION_ERRORS
DBA_REDEFINITION_OBJECTS
REGISTER_DEPENDENT_OBJECT
UNREGISTER_DEPENDENT_OBJECT
SYNC_INTERIM_TABLE
ABORT_REDEF_TABLE
--flash back drop table
SELECT * FROM RECYCLEBIN;
BIN$unique_id$version
ALTER SESSION SET recyclebin = ON;
ALTER SESSION SET recyclebin = OFF;
USER_RECYCLEBIN
DBA_RECYCLEBIN
PURGE TABLE BIN$jsleilx392mk2=293$0;
PURGE TABLESPACE example;
PURGE TABLESPACE example USER oe;
PURGE RECYCLEBIN;
FLASHBACK TABLE int_admin_emp TO BEFORE DROP RENAME TO int2_admin_emp;
--iot索引表:可以分為index 和overflow兩部分儲存
Index-Organized Tables
ALTER TABLE admin_iot5 MOVE NOCOMPRESS;
ALTER TABLE admin_docindex MOVE ONLINE;
ALTER TABLE admin_docindex MOVE TABLESPACE admin_tbs2 OVERFLOW TABLESPACE admin_tbs3;
Secondary Indexes on Index-Organized Tables --They store logical rowids instead of physical rowids.--The logical rowid also includes a physical guess
ALTER INDEX ... UPDATE BLOCK REFERENCES
EXECUTE DBMS_STATS.GATHER_TABLE_STATS ('HR','COUNTRIES');
--table 資料字典
DBA_TABLES
ALL_TABLES
USER_TABLES
DBA_TAB_COLUMNS
ALL_TAB_COLUMNS
USER_TAB_COLUMNS
DBA_ALL_TABLES
ALL_ALL_TABLES
USER_ALL_TABLES
DBA_TAB_COMMENTS
ALL_TAB_COMMENTS
USER_TAB_COMMENTS
DBA_COL_COMMENTS
ALL_COL_COMMENTS
USER_COL_COMMENTS
DBA_EXTERNAL_TABLES
ALL_EXTERNAL_TABLES
USER_EXTERNAL_TABLES
DBA_EXTERNAL_LOCATIONS
ALL_EXTERNAL_LOCATIONS
USER_EXTERNAL_LOCATIONS
DBA_TAB_HISTOGRAMS
ALL_TAB_HISTOGRAMS
USER_TAB_HISTOGRAMS
DBA_TAB_STATISTICS
ALL_TAB_STATISTICS
USER_TAB_STATISTICS
DBA_TAB_COL_STATISTICS
ALL_TAB_COL_STATISTICS
USER_TAB_COL_STATISTICS
DBA_TAB_MODIFICATIONS
ALL_TAB_MODIFICATIONS
USER_TAB_MODIFICATIONS
DBA_ENCRYPTED_COLUMNS
USER_ENCRYPTED_COLUMNS
ALL_ENCRYPTED_COLUMNS
DBA_UNUSED_COL_TABS
ALL_UNUSED_COL_TABS
USER_UNUSED_COL_TABS
DBA_PARTIAL_DROP_TABS
ALL_PARTIAL_DROP_TABS
USER_PARTIAL_DROP_TABS
[@more@]
Table Compression 用於只讀表提高io效能,減少cache
NOLOGGING 用於create table as select /ctas
Parallelizing 用於ctas 多處理器的情形
--臨時表,對所有session可見,不過資料只對session可見
CREATE GLOBAL TEMPORARY TABLE transaction-specific (the default) or session-specific,
DELETE ROWS transaction-specific
PRESERVE ROWS session-specific
--事務級的臨時表
CREATE GLOBAL TEMPORARY TABLE admin_work_area
(startdate DATE,
enddate DATE,
class CHAR(20))
ON COMMIT DELETE ROWS;--transaction-specific
--臨時表的內容,是由INSERT觸發的,並分配segment如果沒有insert,臨時表是沒有資料的;臨時表上可以建立index;沒有session邦定臨時表時才可以drop臨時表
--Parallelizing
ALTER SESSION FORCE PARALLEL DDL
A PARALLEL clause is included in the CREATE TABLE...AS SELECT statement
--例如
CREATE TABLE hr.admin_emp_dept
PARALLEL COMPRESS
AS SELECT * FROM hr.employees
WHERE department_id = 10;
--大容量操作,記錄錯誤記錄,避免大容量回滾誤時誤事
EXECUTE DBMS_ERRLOG.CREATE_ERROR_LOG('AAATTT', 'ERR_AAATTT');
INSERT INTO AAATTT(ID,NAME)
VALUES( '222222','22')
LOG ERRORS INTO ERR_AAATTT ('daily_load') REJECT LIMIT 25;
select t.*, t.rowid from err_aaattt t;
create table AAATTT
(
ID CHAR(5) not null,
NAME CHAR(10),
NOTE CHAR(30),
XINGMING VARCHAR2(10),
XINGM VARCHAR2(10),
NUM NUMBER(5,3),
NUM2 NUMBER(4),
NUM3 NUMBER(*,3),
DAT DATE,
TIMLZ TIMESTAMP(6) WITH LOCAL TIME ZONE,
TIMZ TIMESTAMP(6) WITH TIME ZONE,
CONSTRAIT PK_AAATTT PRIMARY KEY (ID)
)
--對應的error table為 err_aaattt
create table ERR_AAATTT
(
ORA_ERR_NUMBER$ NUMBER,
ORA_ERR_MESG$ VARCHAR2(2000),
ORA_ERR_ROWID$ UROWID(4000),
ORA_ERR_OPTYP$ VARCHAR2(2),
ORA_ERR_TAG$ VARCHAR2(2000),
ID VARCHAR2(4000),
NAME VARCHAR2(4000),
NOTE VARCHAR2(4000),
XINGMING VARCHAR2(4000),
XINGM VARCHAR2(4000),
NUM VARCHAR2(4000),
NUM2 VARCHAR2(4000),
NUM3 VARCHAR2(4000),
DAT VARCHAR2(4000),
TIMLZ VARCHAR2(4000),
TIMZ VARCHAR2(4000)
)
--Inserting Data Into Tables Using Direct-Path INSERT 是在high-water mark之上insert data,而不是使用hwm下面的free space
ALTER TABLE hr.admin_emp MOVE
STORAGE ( INITIAL 20K
NEXT 40K
MINEXTENTS 2
MAXEXTENTS 20
PCTINCREASE 0 );
ALTER TABLE hr.admin_emp DROP (bonus, commission);
ALTER TABLE hr.admin_emp RENAME COLUMN comm TO commission;
ALTER TABLE hr.admin_emp ADD (bonus NUMBER (7,2));
ALTER TABLE hr.admin_emp SET UNUSED (hiredate, mgr);
ALTER TABLE...DROP UNUSED COLUMNS
--表線上重新定義;額外需要待重新定義的表的空間大小
DBMS_REDEFINITION by primary key or by rowid(iot除外)
CAN_REDEF_TABLE
alter session force parallel dml parallel degree-of-parallelism;
alter session force parallel query parallel degree-of-parallelism;
START_REDEF_TABLE
ABORT_REDEF_TABLE
COPY_TABLE_DEPENDENTS
FINISH_REDEF_TABLE
ALTER TABLE table_name SET UNUSED (M_ROW$$);
DBA_REDEFINITION_ERRORS
DBA_REDEFINITION_OBJECTS
REGISTER_DEPENDENT_OBJECT
UNREGISTER_DEPENDENT_OBJECT
SYNC_INTERIM_TABLE
ABORT_REDEF_TABLE
--flash back drop table
SELECT * FROM RECYCLEBIN;
BIN$unique_id$version
ALTER SESSION SET recyclebin = ON;
ALTER SESSION SET recyclebin = OFF;
USER_RECYCLEBIN
DBA_RECYCLEBIN
PURGE TABLE BIN$jsleilx392mk2=293$0;
PURGE TABLESPACE example;
PURGE TABLESPACE example USER oe;
PURGE RECYCLEBIN;
FLASHBACK TABLE int_admin_emp TO BEFORE DROP RENAME TO int2_admin_emp;
--iot索引表:可以分為index 和overflow兩部分儲存
Index-Organized Tables
ALTER TABLE admin_iot5 MOVE NOCOMPRESS;
ALTER TABLE admin_docindex MOVE ONLINE;
ALTER TABLE admin_docindex MOVE TABLESPACE admin_tbs2 OVERFLOW TABLESPACE admin_tbs3;
Secondary Indexes on Index-Organized Tables --They store logical rowids instead of physical rowids.--The logical rowid also includes a physical guess
ALTER INDEX ... UPDATE BLOCK REFERENCES
EXECUTE DBMS_STATS.GATHER_TABLE_STATS ('HR','COUNTRIES');
--table 資料字典
DBA_TABLES
ALL_TABLES
USER_TABLES
DBA_TAB_COLUMNS
ALL_TAB_COLUMNS
USER_TAB_COLUMNS
DBA_ALL_TABLES
ALL_ALL_TABLES
USER_ALL_TABLES
DBA_TAB_COMMENTS
ALL_TAB_COMMENTS
USER_TAB_COMMENTS
DBA_COL_COMMENTS
ALL_COL_COMMENTS
USER_COL_COMMENTS
DBA_EXTERNAL_TABLES
ALL_EXTERNAL_TABLES
USER_EXTERNAL_TABLES
DBA_EXTERNAL_LOCATIONS
ALL_EXTERNAL_LOCATIONS
USER_EXTERNAL_LOCATIONS
DBA_TAB_HISTOGRAMS
ALL_TAB_HISTOGRAMS
USER_TAB_HISTOGRAMS
DBA_TAB_STATISTICS
ALL_TAB_STATISTICS
USER_TAB_STATISTICS
DBA_TAB_COL_STATISTICS
ALL_TAB_COL_STATISTICS
USER_TAB_COL_STATISTICS
DBA_TAB_MODIFICATIONS
ALL_TAB_MODIFICATIONS
USER_TAB_MODIFICATIONS
DBA_ENCRYPTED_COLUMNS
USER_ENCRYPTED_COLUMNS
ALL_ENCRYPTED_COLUMNS
DBA_UNUSED_COL_TABS
ALL_UNUSED_COL_TABS
USER_UNUSED_COL_TABS
DBA_PARTIAL_DROP_TABS
ALL_PARTIAL_DROP_TABS
USER_PARTIAL_DROP_TABS
[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70612/viewspace-1024814/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle:TABLE MONITORINGOracle
- Oracle table selectOracle
- oracle cache table(轉)Oracle
- Oracle Pipelined Table(轉)Oracle
- Oracle Pipelined Table Functions(轉)OracleFunction
- Oracle Table建立引數說明Oracle
- Analyze table對Oracle效能的提升Oracle
- Oracle cluster table(1)_概念介紹Oracle
- ORACLE _small_table_threshold與eventOracle
- oracle truncate table recover(oracle 如何拯救誤操作truncate的表)Oracle
- use azure data studio to create external table for oracleOracle
- 【TABLE】Oracle表資訊收集指令碼Oracle指令碼
- 深入解析 oracle drop table內部原理Oracle
- Oracle 12.2之後ALTER TABLE .. MODIFY轉換非分割槽表為分割槽表Oracle
- Oracle 19c Concepts(02):Tables and Table ClustersOracle
- 14_深入解析Oracle table cluster結構Oracle
- mysql之 OPTIMIZE TABLE整理碎片MySql
- 有關oracle external table的一點測試。Oracle
- 【TABLE】Oracle監控異常的表設計Oracle
- oracle 19c 無法create table解決Oracle
- oracle表空間不足:ORA-01653: unable to extend tableOracle
- Oracle中獲取TABLE的DDL語句的方法Oracle
- Oracle 任務管理之 ----program(程式)---scheduler(計劃)--Job(任務)Oracle
- oracle drop table purge無備份bbed恢復(3/3)Oracle
- oracle drop table purge無備份bbed恢復(1/3)Oracle
- oracle drop table purge無備份bbed恢復(2/3)Oracle
- HTML標籤之form,input,button,tableHTMLORM
- oracle job管理(zt)Oracle
- Can GoldenGate Replicate An Oracle Table That Contains Only CLOB Column(s)? (Doc ID 971833.1)GoOracleAI
- 【TUNE_ORACLE】列出走了TABLE ACCESS FULL的SQL參考OracleSQL
- [20230227][20230109]Oracle Global Temporary Table ORA-01555 and Undo Retention.tOracle
- Element UI 原始碼解讀之 Table 元件UI原始碼元件
- 12c RMAN新特性之Recover Table
- 二十三、Flink Table API之基本APIAPI
- MySQL資料災難挽救之truncate tableMySql
- MySQL資料災難挽救之drop tableMySql
- Oracle OCP(21):管理表Oracle
- ORACLE 概要檔案管理Oracle
- Oracle OCP(58):ARCHIVELOG 管理OracleHive