11. 怎樣得到觸發器、過程、函數的建立指令碼?
desc user_source
user_triggers
12. 怎樣計算一個表佔用的空間的大小?
select owner,table_name,
NUM_ROWS,
BLOCKS*AAA/1024/1024 "Size M",
EMPTY_BLOCKS,
LAST_ANALYZED
from dba_tables
where table_name='XXX';
Here: AAA is the value of db_block_size ;
XXX is the table name you want to check
13. 如何查看最大會話數?
SELECT * FROM V$PARAMETER WHERE NAME LIKE 'proc%';
SQL>
SQL> show parameter processes
NAME TYPE VALUE
------------------------------------ ------- ------------------------------
aq_tm_processes integer 1
db_writer_processes integer 1
job_queue_processes integer 4
log_archive_max_processes integer 1
processes integer 200
這裡為200個使用者。
select * from v$license;
其中sessions_highwater紀錄曾經到達的最大會話數
14. 如何查看系統被鎖的事務時間?
select * from v$locked_object ;
15. 如何以archivelog的方式運行oracle。
init.ora
log_archive_start = true
RESTART DATABASE
16. 怎么擷取有哪些使用者在使用資料庫
select username from v$session;
17. 資料表中的欄位最大數是多少?
表或視圖中的最大列數為 1000
18. 怎樣查得資料庫的SID ?
select name from v$database;
也可以直接查看 init.ora檔案
19. 如何在Oracle伺服器上通過SQLPLUS查看本機IP地址 ?
select sys_context('userenv','ip_address') from dual;
如果是登陸本機資料庫,只能返回127.0.0.1,呵呵
20. unix 下怎么調整資料庫的時間?
su -root
date -u 08010000