資源描述:
《oracle 創(chuàng)建create user 及授權(quán)grant 查看登陸用戶》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、oracle創(chuàng)建createuser及授權(quán)grant查看登陸的用戶oracle創(chuàng)建createuser及授權(quán)grant查看登陸的用戶.txt沒(méi)有不疼的傷口,只有流著血卻微笑的人有時(shí)候給別人最簡(jiǎn)單的建議卻是自己最難做到的。oracle創(chuàng)建createuser及授權(quán)grant查看登陸的用戶:以下都可以:showuser;selectsys_context('userenv','session_user')fromdual;selectuserfromdual;查看所有登錄的用戶必須為DBA用戶:selectusernamefromv$session;sys、system等DB
2、A用戶查看其他用戶(test)中的對(duì)象(表):SQL>select*fromtest.student;創(chuàng)建一個(gè)普通用戶都把該用戶用起來(lái)的流程:1、創(chuàng)建用戶SQL>createusertestindentifiedbytest;這樣就創(chuàng)建了一個(gè)用戶名密碼都為test的用戶但這個(gè)時(shí)候test還是不能登陸成功的,我們需要賦予相應(yīng)的權(quán)限2、賦予createsession的權(quán)限SQL>grantcreatesessiontotest;這樣test用戶就能成功登陸進(jìn)去但是此時(shí)用戶還是不能創(chuàng)建表我們需要賦予用戶創(chuàng)建表的權(quán)限:SQL>grantcreatetabletotest;但是用戶
3、此時(shí)還不能創(chuàng)建表因?yàn)樾枰惺褂帽砜臻g的權(quán)限(相當(dāng)于用戶有了進(jìn)房間的鑰匙但是沒(méi)有進(jìn)大門(mén)的鑰匙。。。)所以也應(yīng)該賦予相應(yīng)的權(quán)限SQL>grantunlimitedtablespacetotest;這個(gè)時(shí)候用戶就擁有了創(chuàng)建表的權(quán)限由于表是用戶test的相應(yīng)的他就擁有了對(duì)創(chuàng)建的表的增刪查改的權(quán)限了3、查看用戶擁有什么權(quán)限可以通過(guò)查詢(xún)一個(gè)系統(tǒng)的視圖(數(shù)字字典)SQL>select*fromuser_sys_privs;這樣就可以知道當(dāng)前用戶的權(quán)限4、撤銷(xiāo)權(quán)限SQL>revokecreatetablefromtest;-----------------------------一些常用
4、視圖的區(qū)分dba_tablesdba_all_tablesuser_tablesuser_all_tablesall_tablesall_all_tables當(dāng)前用戶所屬的所有表(注意大寫(xiě))SQL>selecttablespace_name,table_namefromuser_all_tableswheretable_name='STUDENT';SQL>selecttable_name,tablespace_namefromuser_tableswheretable_name='STUDENT';TABLE_NAMETABLESPACE_NAME-----------
5、-------------------------------------------------STUDENTUSERSsys要查看dba_all_tables,ALL_ALL_TABLES才能查看到test用戶的表。SQL>selectowner,table_name,tablespace_namefromdba_all_tableswhereowner='TEST';SQL>selectowner,table_name,tablespace_namefromall_all_tableswhereowner='TEST';SQL>selectowner,table_n
6、ame,tablespace_namefromdba_tableswhereowner='TEST';SQL>selectowner,table_name,tablespace_namefromALL_tableswhereowner='TEST';OWNERTABLE_NAMETABLESPACE_NAME------------------------------------------------------------------------------------------TESTSTUDENTUSERS1.DBA_ALL_TABLESdescribesall
7、objecttablesandrelationaltablesinthedatabase.ItscolumnsarethesameasthoseinALL_ALL_TABLES.2.ALL_ALL_TABLESdescribestheobjecttablesandrelationaltablesaccessibletothecurrentuser.3.USER_ALL_TABLESdescribestheobjecttablesandrelationaltablesownedbythecurrentuser.Itscolumn