溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

oracle常用命令

發(fā)布時間:2020-07-12 02:16:52 來源:網(wǎng)絡(luò) 閱讀:175 作者:涼了涼了 欄目:關(guān)系型數(shù)據(jù)庫

修改密碼

alter user DBUSER identified by 123456;

查詢表空間中數(shù)據(jù)文件具體位置

select name from v$datafile;

查詢表空間中數(shù)據(jù)文件具體位置和文件名,表空間名等。

Select * FROM DBA_DATA_FILES;比上一個全

連接命令

conn[ect]

用法:conn 用戶名/密碼@網(wǎng)絡(luò)服務(wù)名 [as sysdba/sysoper]

說明:當用特權(quán)用戶身份連接時,必須帶上as sysdba或是as sysoper

SQL> show user

USER 為 "SCOTT"

SQL> conn system/oracle

start和@

說明: 運行sql腳本

案例: sql>@ d:\a.sql或是sql>start d:\a.sql

edit

說明: 該命令可以編輯指定的sql腳本

案例: sql>edit d:\a.sql,這樣會把d:\a.sql 這個文件打開

spool

說明: 該命令可以將sql*plus屏幕上的內(nèi)容輸出到指定文件中去。

案例: sql>spool d:\b.sql并輸入sql>spool off

eg.

sql>spool d:\b.sql;

sql>select * from emp;

sql>spool off; 


設(shè)置顯示行的寬度,默認是80個字符

linesize

show linesize

set linesize 90

set lin 9999

設(shè)置每頁顯示的行數(shù)目,默認是14

pagesize

用法和linesize 一樣


spfile參數(shù)查詢:

show parameter sga  

select name,type,value from v$parameter where name like '%sga%';  

archive log list                                    //查看歸檔模式,DG必須是歸檔模式

select name from v$datafile;              //查看數(shù)據(jù)文件位置

select member from v$logfile;           //查看日志位置


查看控制文件位置:

select name from v$controlfile; 


查看oracle版本命令:

select * from v$version;


1. 查詢oracle中所有用戶信息

select * from dba_users;

2. 只查詢用戶和密碼

select username,password from dba_users;

3. 查詢當前用戶信息

select * from dba_ustats;

4. 查詢用戶可以訪問的視圖文本

select * from dba_varrays;

5. 查詢數(shù)據(jù)庫中所有視圖的文本

select * from dba_views;

select distinct  tablespace_name from  SYS.DBA_FREE_SPACE  where tablespace_name like '%RB%';

select * from   dba_objects where  object_name='JDE900_F0005';

select  * from rbods.jde900_f0005;

select * from  rbodm.dim_company;


查看當前用戶的缺省表空間

select username,default_tablespace from user_users


查看當前用戶的角色

select * from user_role_privs

查看當前用戶的系統(tǒng)權(quán)限和表級權(quán)限

select * from user_sys_privs

select * from user_tab_privs


查看用戶下所有的表

select * from user_tables


顯示用戶信息(所屬表空間)

select default_tablespace,temporary_tablespace from dba_users


顯示當前會話所具有的權(quán)限

select * from session_privs


顯示指定用戶所具有的系統(tǒng)權(quán)限

select * from dba_sys_privs


顯示特權(quán)用戶

select * from v$pwfile_users


查看名稱包含log字符的表

select object_name,object_id from user_objects where instr(object_name,'log')>0


查看某表的創(chuàng)建時間

select object_name,created from user_objects where object_name='ZW_YINGYEZ'


查看某表的大小

select sum(bytes)/(1024*1024) tablesize from user_segments where segment_name='ZW_YINGYEZ'


查看放在ORACLE的內(nèi)存區(qū)里的表

select table_name,cache from user_tables where instr(cache,'Y')>0


查看索引個數(shù)和類別

select index_name,index_type,table_name from user_indexes order by table_name


查看索引被索引的字段

select * from user_ind_columns where table_name='CB_CHAOBIAOSJ201004'

查看索引的大小

select sum(bytes)/(1024*1024) as indexsize from user_segments

where segment_name=upper('AS_MENUINFO')

查看視圖信息

select * from user_views

查看同義詞的名稱

select * from user_synonyms

查看函數(shù)和過程的狀態(tài)

select object_name,status from user_objects where object_type='FUNCTION'

select object_name,status from user_objects where object_type='PROCEDURE'

查看函數(shù)和過程的源代碼

select text from all_source where owner=user and name='SF_SPLIT_STRING'

查看表字段

select cname from col where tname='ZW_YINGYEZ'

select column_name from user_tab_columns where table_name='ZW_YINGYEZ'

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI