在Oracle 11G R2里启用示例帐户scott

Oracle里,默认有个示例帐户scott。不过在oracle11g r2里,默认是被禁用了。直接登的话,会得到如下情形。

SQL> conn scott/tiger
ERROR:
ORA-28000: the account is locked

该账户现在默认是被锁定状态。下面简单说下如何启用它。

1,以sysdba进入sqlplus

$ /u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus "/as sysdba"

2,解锁scott 帐户

SQL> alter user scott account unlock ;

3,修改密码。第一次登入的时候,会提示密码已经过去。这时候输入新的密码。

SQL> conn scott/tiger;
ERROR:
ORA-28001: the password has expired

Changing password for scott
New password:
Retype new password:
Password changed
Connected.
SQL>

4,访问EMP表。scott里有个表EMP,装了一些示例数据。

SQL> desc emp;
Name                                      Null?    Type
----------------------------------------- -------- ----------------------------
EMPNO                                     NOT NULL NUMBER(4)
ENAME                                              VARCHAR2(10)
JOB                                                VARCHAR2(9)
MGR                                                NUMBER(4)
HIREDATE                                           DATE
SAL                                                NUMBER(7,2)
COMM                                               NUMBER(7,2)
DEPTNO                                             NUMBER(2)

SQL>

你可能感兴趣的:(oracle,示例,休闲,帐户,scott)