一般來說,oracle資料庫安裝後,裡面有很多個預設帳號和密碼,比較常用的是:
帳號:scott 密碼:tiger 帳號:system 密碼:manager 帳號:sys 密碼:任一字元。
當我們想建立一個帳號時,可以使用sys登入sysdba後,建立使用者(需要授權),代碼如下
| 1 2 3 4 5 |
create user 使用者名稱 identified by "密碼" ; 授權: grant create session to 使用者名稱; grant create table to 使用者名稱; grant create tablespace to 使用者名稱; grant create view to 使用者名稱; grant create sequence to 使用者名稱; |
請輸入使用者名稱: system
輸入口令:
串連到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create user QC identified by "qc";
使用者已建立。
SQL> grant create session to QC;
授權成功。
SQL> grant create table to QC;
授權成功。
SQL> grant create tablespace to QC;
授權成功。
SQL> grant create view to QC;
授權成功。
SQL>grant create sequence to QC;
授權成功。
之後就可以用新設定的使用者登入了。
我們一般使用的是用scott登入sysdba,這時候有可能出現賬戶未解鎖的狀態,這時候可以用
| 1 |
alter user scott account unlock; |
來解鎖賬戶。解鎖之後可能會要求你改密碼:可以用
| 1 |
alter user scott identified by tiger; |
再登入