新聞中心
查看oracle版本
常寧ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!
select banner from sys.v_$version;
-------------------------------------
查看不同用戶的連接數(shù)
select username,count(username) from v$session where username is not null group by username;
-------------------------------------
查詢oracle的并發(fā)連接數(shù)
select count(*) from v$session where status='ACTIVE';
--------------------------------------
Oracle數(shù)據(jù)庫中表的導(dǎo)入導(dǎo)出操作:
以Windows下的數(shù)據(jù)庫為例(用cmd方式):
導(dǎo)出表:
1.導(dǎo)出整個數(shù)據(jù)庫
exp 導(dǎo)表的用戶名/密碼@實例名 file='E:\xxx.dmp' full=y
2.導(dǎo)出單表或多表
exp 導(dǎo)表的用戶名/密碼@實例名 file='E:\xxx.dmp' tables=t1[(t1,t2,t3)]
3.導(dǎo)出數(shù)據(jù)庫中一個或多個用戶下的表
exp 導(dǎo)表的用戶名/密碼@實例名 file='E:\xxx.dmp' owner=(system,sys)
4.將數(shù)據(jù)庫中的表table1中的字段filed1以"00"打頭的數(shù)據(jù)導(dǎo)出
exp 導(dǎo)表的用戶名/密碼@實例名 file='E:\xxx.dmp' tables=(table1) query=\" where filed1 like '00%'\"
------------------------------------------
導(dǎo)入表:
將E:\xxx.dmp 中的數(shù)據(jù)導(dǎo)入某數(shù)據(jù)庫中。
imp 導(dǎo)表的用戶名/密碼@實例名 file=e:\xxx.dmp
imp 導(dǎo)表的用戶名/密碼@實例名 full=y file=e:\xxx.dmp ignore=y
在后面加上 ignore=y 忽略導(dǎo)入的報錯,直接導(dǎo)入。
2 將e:\xxx.dmp中的表table1 導(dǎo)入
imp 導(dǎo)表的用戶名/密碼@實例名 file=e:\xxx.dmp tables=(table1)
----------------------------
Linux的話直接exp,imp根據(jù)提示操作,效果也是一樣的。如果通過語句,可以現(xiàn)在emedit上寫好直接復(fù)制黏貼即可。
---------------------------
數(shù)據(jù)庫中查看版本:
select * from v$version;
Linux下查看ORACLE版本信息:
file $ORACLE_HOME/bin/oracle
-------------------------
數(shù)據(jù)庫服務(wù)器查看字符集:
select * from nls_database_parameters;
其中NLS_CHARACTERSET下面的就是該數(shù)據(jù)庫服務(wù)器的字符集
-------------------------
查看表空間xxx使用情況:(需sysdba權(quán)限):
select /*+ ordered use_merge(a,b) */
a.tablespace_name 表空間名,
total/(1024*1024) 表空間大小,
(total-free)/(1024*1024) 表空間使用大小,
free/(1024*1024) 表空間剩余大小,
round((total-free)/total,4)*100 "使用率%"
from (select tablespace_name,sum(bytes) free from dba_free_space
group by tablespace_name) a,
(select tablespace_name,sum(bytes) total from dba_data_files
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name
and a.tablespace_name = 'xxx';
-------------------------
查看當前用戶下的表空間:(非sysdba)
select
a.bytes/1024/1024 "used(MB)",
b.bytes/1024/1024 "free(MB)",
a.bytes/1024/1024+b.bytes/1024/1024 "total(MB)"
from user_ts_quotas a,user_free_space b
where a.TABLESPACE_NAME=b.TABLESPACE_NAME and a.TABLESPACE_NAME='XXX';
-------------------------
查看當前角色XXX所具有的權(quán)限:
select * from dba_sys_privs where grantee='XXX';
-------------------------
查看當前用戶所具有的角色:
select * from user_role_privs;
select * from session_privs;
-------------------------
查看當前用戶的系統(tǒng)權(quán)限和表級權(quán)限
select * from user_sys_privs;
select * from user_tab_privs;
-------------------------
查看哪些用戶具有sysdba或sysooper權(quán)限:
select * from V$PWFILE_USERS;
-------------------------
查看用戶為XXX的表空間配額。(-1為不受限制)
select tablespace_name,username,max_bytes from DBA_TS_QUOTAS where username='XXX';
-------------------------
設(shè)定用戶mc的表空間配額限為100M:
alter user mc quota 100M on tablespacname;
-------------------------
設(shè)定用戶mc的表空間配額為無限制:
alter user mc quota unlimited on tablespacname;
-------------------------
賦予用戶mc配置表空間無限額的權(quán)限:
grant unlimited tablespace to mc;
-------------------------
查看當前數(shù)據(jù)庫的實例名:
select instance_name from v$instance;
-------------------------
修改用戶表空間和臨時表空間:
ALTER USER SCOTT DEFAULT TABLESPACE USERS;
ALTER USER SCOTT TEMPORARY TABLESPACE TEMP;
-------------------------
查看當前用戶缺省的表空間:
select username,default_tablespace from user_users;
--------------------------------
查看歸檔是否開啟;開啟/關(guān)閉歸檔:
--------------
查看歸檔:
sqlplus>archive log list;
開啟歸檔
sqlplus>shutdown immediate;(啟動歸檔前先要停止數(shù)據(jù)庫)
sqlplus>startup mount;(數(shù)據(jù)庫以mount方式啟動)
sqlplus>alter database archivelog;(啟動數(shù)據(jù)庫歸檔)
sqlplus>alter system set log_archive_dest_1="/arch"(改變路徑,使用盤符)
sqlplus>alter database open;(打開數(shù)據(jù)庫)
sqlplus>archive log list;(查看歸檔是否已經(jīng)打開)
關(guān)閉歸檔
alter database noarchivelog;
--------------
查看歸檔日志使用情況:
select * from v$flash_recovery_area_usage;
-----------------------
查看用戶賬戶狀態(tài):
select username,account_status from dba_users where username in ('DBSNMP','SYSMAN');
----------------------------
查看REDO日志位置、狀態(tài),以及添加、刪除REDO日志組方法:
位置:
select * form v$logfile;
狀態(tài):
select group#,thread#,bytes/1024/1024,status from v$log;
:添加
alter database add logfile group 1|2|3|4('/u01/oracle/oradata/mcocp/redo01|02|03|04') size 100m;
刪除:
alter database drop logfile group 1|2|3|4;
注:oracle11g默認的redo logsize為50M
----------------------------------------
當前文章:Oracle日常巡檢維護中常用的一些STUFF
瀏覽路徑:http://www.dlmjj.cn/article/ghheho.html