create table t1 (id number,name varchar2(10)) row archival;
# 开启或关闭归档 alter table t1 no row archival; alter table t1 row archival;
# 查看字段 col column_name for a20 col data_type for a20 SELECT column_id, column_name, data_type, data_length, hidden_column FROM user_tab_cols WHERE table_name = 'T1' ORDER BY column_id;
COLUMN_ID COLUMN_NAME DATA_TYPE DATA_LENGTH HID ---------- -------------------- -------------------- ----------- --- 1 ID NUMBER 22 NO 2 NAME VARCHAR2 10 NO ORA_ARCHIVE_STATE VARCHAR2 4000 YES >>>>====如果开启数据库内归档,则会自动生成这个隐藏字段
# 关闭归档 alter table t1 no row archival; SELECT column_id, column_name, data_type, data_length, hidden_column FROM user_tab_cols WHERE table_name = 'T1' ORDER BY column_id;
COLUMN_ID COLUMN_NAME DATA_TYPE DATA_LENGTH HID ---------- -------------------- -------------------- ----------- --- 1 ID NUMBER 22 NO 2 NAME VARCHAR2 10 NO >>>>==== ORA_ARCHIVE_STATE字段消失
drop table t2 purge; create table t2 as select * from t1;
# 查询目标表,由于目标表没有开启归档,所有不包含隐藏列 xb@PDB12C> select id,name,ora_archive_state from t2; select id,name,ora_archive_state from t2 * ERROR at line 1: ORA-00904: "ORA_ARCHIVE_STATE": invalid identifier