oracle的閃回操作及一些相關知識點

2022-09-19 19:00:14 字數 931 閱讀 1160

在查詢oracle資料表最近一次更新時間時查了些資料,做個總結

alter table test_table enable row  movement ;

# 閃回

flashback table test_table to timestamp to_timestamp('2021-11-17 18:00:00','yyyy-mm-dd hh24:mi:ss');

關於獲取oracle中資料變更的時間戳的探索

oracle存在rownum, rowid, ora_rowscn這樣的偽列

select rownum, rowid, ora_rowscn from  test_table ;
其中oracle中scn有最小值

# 查詢當前最小scn  -- 五天前

select min(scn) from sys.smon_scn_time;

# scn轉日期 , 小於min(scn)會報錯

select to_char(scn_to_timestamp(25119557960751), 'yyyy-mm-dd hh24:mi:ss') from dual

# 日期轉scn , 小於min(scn)對應的timestamp會報錯

select timestamp_to_scn(to_date('2022-01-21 06:58:34','yyyy-mm-dd hh24:mi:ss')) from dual ;

# 查詢資料表某一時刻的快照 , 小於min(scn)對應的timestamp會報錯

select * from test_table as of timestamp to_date('2022-01-21 11:19','yyyy-mm-dd hh24:mi');

ORACLE 的一些操作

檢視表建立時間 select ao.from all objects ao where object name module and object type table select from user tables select username,count username from v ses...

oracle的一些操作

1.select count from v session select count from v process 檢視當前總會話數和程序數,這兩個檢視就是跟會話及程序有關的重要檢視啦,資訊都是從這裡面取的。2.查詢那些應用的連線數此時是多少 select b.machine,b.program c...

oracle的一些操作

dba可以檢視資料庫有多少個使用者 select username from dba users dba如何檢視oracle有多少個表空間。select tablespace name from dba tablespaces 檢視乙個表空間有多少張表,而且表空間名字是字串,區分大小寫 select...