查詢表被鎖住
--查詢被鎖的表 select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id; --查看是哪個session引起的 select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time; --殺掉對應進程即解鎖 alter system kill session '1190,3103';
查詢存儲過程被鎖住
--查詢存儲過程被鎖 --查V$DB_OBJECT_CACHE SELECT * FROM V$DB_OBJECT_CACHE WHERE name='P_QUERY_BILL_LIST' AND LOCKS!='0'; --按對象查出sid的值 select /*+ rule*/ SID from V$ACCESS WHERE object='P_QUERY_BILL_LIST'; --查sid,serial# SELECT SID,SERIAL#,PADDR FROM V$SESSION WHERE SID in ('1160'); --殺掉對應進程即解鎖 alter system kill session '1160,41565';
數據庫數據被刪掉,恢復刪掉的數據
--數據庫恢復 insert into sys_user_t value( select * from sys_user_t as of timestamp to_timestamp('2019-10-17 10:20:00','yyyy-mm-dd hh24:mi:ss') )
查詢數據庫對象(表,存儲過程等)什么時候被修改過
-- 查詢最后修改的對象 SELECT object_name,CREATED,LAST_DDL_TIME from user_objects order by last_ddl_time desc; SELECT object_name,CREATED,LAST_DDL_TIME from user_objects order by created desc;
oracle查詢數據庫編碼
-- 編碼 select userenv('language')from dual
設置本地環境變量
環境變量名:NLG_LANG
環境變量值:SIMPLIFIED CHINESE_CHINA.ZHS16GBK