oracle基本操作
desc all_tables; --查看表結(jié)構(gòu)
select from all_tables;--查看當(dāng)前數(shù)據(jù)庫所有的表
select table_name from user_tables;查看當(dāng)前登錄的用戶的表:
select from dba_users;查看有哪些用戶
創(chuàng)新互聯(lián),專注為中小企業(yè)提供官網(wǎng)建設(shè)、營(yíng)銷型網(wǎng)站制作、成都響應(yīng)式網(wǎng)站建設(shè)公司、展示型網(wǎng)站建設(shè)、成都網(wǎng)站制作等服務(wù),幫助中小企業(yè)通過網(wǎng)站體現(xiàn)價(jià)值、有效益。幫助企業(yè)快速建站、解決網(wǎng)站建設(shè)與網(wǎng)站營(yíng)銷推廣問題。
修改密碼過期策略
1.查看用戶存放密碼策略的proifle:
SELECT USERNAME,PROFILE FROM DBA_USERS;
2.查看當(dāng)前的密碼策略過期天數(shù)
SELECT * FROM DBA_PROFILES WHERE PROFILE='DEFAULT' AND RESOURCE_NAME='PASSWORD_LIFE_TIME';
3.修改密碼過期策略
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
4.登錄dba或者有權(quán)限的用戶更改密碼
DBA更改:
alter user test IDENTIFIED BY 123456;
普通用戶更改用戶密碼:
ALTER USER test IDENTIFIED BY 新密碼 replace 舊密碼
dba用戶更改密碼:
ALTER USER test IDENTIFIED BY 123456
普通用戶更改用戶密碼:
ALTER USER test IDENTIFIED BY 新密碼 replace 舊密碼
登錄DBA用戶
sqlplus system/oracle as sysdba
修改最大連接數(shù)和會(huì)話數(shù)
col sid for 9999
col serial# for 99999
col username for a10
col program for a20
col machine for a20
1.查詢數(shù)據(jù)庫當(dāng)前進(jìn)程的連接數(shù):
select count() from v$process;
2.查看數(shù)據(jù)庫當(dāng)前會(huì)話的連接數(shù):
select count() from v$session;
3.查看數(shù)據(jù)庫的并發(fā)連接數(shù):
select sid,serial#,username,program,machine,status from v$session where status='ACTIVE';
4.查看當(dāng)前數(shù)據(jù)庫建立的會(huì)話情況:
select sid,serial#,username,program,machine,status from v$session;
5.修改數(shù)據(jù)庫允許的最大連接數(shù):
alter system set processes = 600 scope = spfile;
6.修改數(shù)據(jù)庫允許的最大會(huì)話數(shù):
在修改最大連接數(shù)時(shí),最大會(huì)話數(shù)會(huì)自動(dòng)修改
查看連接數(shù)
show parameter processes
查看會(huì)話數(shù)
show parameter session
查看默認(rèn)連接數(shù)processes是150
SQL> show parameter process
NAME TYPE VALUE
aq_tm_processes integer 0
cell_offload_processing boolean TRUE
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 0
log_archive_max_processes integer 4
processes integer 150
查看默認(rèn)會(huì)話數(shù)sessions是247
SQL> show parametere session
SP2-0158: unknown SHOW option "parametere"
SP2-0158: unknown SHOW option "session"
SQL> show parameter session
NAME TYPE VALUE
java_max_sessionspace_size integer 0
java_soft_sessionspace_limit integer 0
license_max_sessions integer 0
license_sessions_warning integer 0
session_cached_cursors integer 50
session_max_open_files integer 10
sessions integer 247
shared_server_sessions integer
修改連接數(shù)到600,最大會(huì)話數(shù)會(huì)自動(dòng)更改為922
變化公示:
sessions=processes*1.5+22
SQL> alter system set processes = 600 scope = spfile;
System altered.
不重新啟動(dòng)數(shù)據(jù)庫會(huì)話數(shù)和連接數(shù)不變化
SQL> show parameter session
NAME TYPE VALUE
java_max_sessionspace_size integer 0
java_soft_sessionspace_limit integer 0
license_max_sessions integer 0
license_sessions_warning integer 0
session_cached_cursors integer 50
session_max_open_files integer 10
sessions integer 247
shared_server_sessions integer
SQL> show parameter process;
NAME TYPE VALUE
aq_tm_processes integer 0
cell_offload_processing boolean TRUE
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 0
log_archive_max_processes integer 4
processes integer 150
重新啟動(dòng)下數(shù)據(jù)庫、類似nginx的reload
SQL> startup force
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 562039304 bytes
Database Buffers 218103808 bytes
Redo Buffers 2637824 bytes
Database mounted.
Database opened.
會(huì)話數(shù)和連接數(shù)更改
SQL> show parameter process;
NAME TYPE VALUE
aq_tm_processes integer 0
cell_offload_processing boolean TRUE
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 0
log_archive_max_processes integer 4
processes integer 600
SQL> show parameter session;
NAME TYPE VALUE
java_max_sessionspace_size integer 0
java_soft_sessionspace_limit integer 0
license_max_sessions integer 0
license_sessions_warning integer 0
session_cached_cursors integer 50
session_max_open_files integer 10
sessions integer 922
shared_server_sessions integer
SQL>