如何獲取本地oracle的用戶名和密碼
成都創(chuàng)新互聯(lián)公司主營伊吾網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,app軟件開發(fā)公司,伊吾h5小程序開發(fā)搭建,伊吾網(wǎng)站營銷推廣歡迎伊吾等地區(qū)企業(yè)咨詢
一般來說,oracle數(shù)據(jù)庫安裝后,里面有很多個(gè)默認(rèn)賬號(hào)和密碼,比較常用的是:賬號(hào):scott 密碼:tiger 賬號(hào):system 密碼:manager 賬號(hào):sys 密碼:任意字符。
當(dāng)我們想創(chuàng)建一個(gè)賬號(hào)時(shí),可以使用sys登錄sysdba后,創(chuàng)建用戶(需要授權(quán)),代碼如下
create user 用戶名 identified by "密碼";
授權(quán):grant create session to 用戶名;
grant create table to 用戶名;
grant create tablespace to 用戶名;
grant create view to 用戶名;
我們一般使用的是用scott登錄sysdba,這時(shí)候有可能出現(xiàn)賬戶未解鎖的狀態(tài),這時(shí)候可以用
alter user scott account unlock;
來解鎖賬戶。解鎖之后可能會(huì)要求你改密碼:可以用alter user scott identified by tiger;
再登錄conn scott/tiger;
select?*?from?all_users
可以查看用戶名。
密碼的話,當(dāng)然不能給你查出來,否則豈不安全性一點(diǎn)也沒有了!?
1. 查詢oracle中所有用戶信息
select * from dba_users;
2. 只查詢用戶和密碼
select username,password from dba_users;
3. 查詢當(dāng)前用戶信息
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;
查看當(dāng)前用戶的缺省表空間
select username,default_tablespace from user_users
查看當(dāng)前用戶的角色
select * from user_role_privs
查看當(dāng)前用戶的系統(tǒng)權(quán)限和表級(jí)權(quán)限
select * from user_sys_privs
select * from user_tab_privs
查看用戶下所有的表
select * from user_tables
顯示用戶信息(所屬表空間)
select default_tablespace,temporary_tablespace from dba_users
顯示當(dāng)前會(huì)話所具有的權(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)建時(shí)間
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
查看索引個(gè)數(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'
sys,system是創(chuàng)建oracle實(shí)例是的默認(rèn)用戶。 創(chuàng)建的每個(gè)實(shí)例都會(huì)有。通過以下步驟,可以獲取Oracle實(shí)例中的用戶列表。
1、打開PL/SQL工具,連接Oracle數(shù)據(jù)庫;
2、執(zhí)行sql,select * from v$instance t,即可查看當(dāng)前用戶登錄的實(shí)例;
3、執(zhí)行sql,select * from all_users t ,即可查看當(dāng)前實(shí)例的所有用戶,可以看到SYS、SYSTEM用戶都可以查到;
4、執(zhí)行sql,select count(*) from all_users t ,可以查到當(dāng)前實(shí)例的總用戶數(shù);
select username , to_char(created,'yyyymmddhh24miss') from dba_users where
trunc(created,'dd')=trunc(sysdate,'dd') ;
后面的where 條件可以自己定義。
created是用戶創(chuàng)建的時(shí)間,通過這個(gè)字段可以檢索特定日期范圍內(nèi)的“新用戶”。
一般找是找不到了,除非你自己能想起來或者問他人能問出來。
如果你在本機(jī)的話(注意一定要在數(shù)據(jù)庫安裝的本機(jī),用安裝數(shù)據(jù)庫的用戶登錄)
如下操作:
sqlplus / as sysdba
alter user system identified by abc;
就可以將system用戶的密碼改成abc了。
alter user sys identified by abc;
sys用戶的密碼也改成abc了。
然后你再登錄sqlplus:
sqlplus /nolog
connect sys/abc就可以連接上了。
其他任何的用戶,都可以參照這個(gè)方法進(jìn)行密碼修改。
網(wǎng)頁標(biāo)題:如何查找oracle用戶,查詢oracle用戶
URL地址:http://chinadenli.net/article0/heshoo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、云服務(wù)器、網(wǎng)站收錄、用戶體驗(yàn)、微信公眾號(hào)、網(wǎng)頁設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)