學習Oracle數據庫學習筆記:
一、Oracle數據庫實例
一般我們在登陸Oracle數據庫時,輸入口令內容爲數據庫的實例。比如在安裝時我們設置爲orcl。則輸入口令爲orcl.
二、登陸Oracle
C:\Users\Administrator>sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on 星期六 7月 1 22:34:37 2017
Copyright (c) 1982, 2010, Oracle. All rights reserved.
請輸入用戶名: sys as sysdba
輸入口令:
連接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
三、驗證登陸成功小實例
SQL> select sysdate from dual;
SYSDATE
--------------
01-7月 -17
四、sqlplus下的一些命令:
clear screen;
show user;
create user muniu identified by liuma;
SQL> show user;
USER 爲 "SYS"
SQL> create user muniu identified by liuma;
用戶已創建。
五、授權與回收權限:
授權:
grant connect,resource,dba to muniu;
grant dba to liuma;
revoke dba from liuma;
revoke resource from muniu;
SQL> create user muniu identified by liuma;
用戶已創建。
SQL> create user liuma identified by muniu;
用戶已創建。
SQL> grant connect,resource,dba to muniu;
授權成功。
SQL> grant dba to liuma;
授權成功。
SQL> revoke dba from liuma;
撤銷成功。
SQL> revoke resource from muniu;
撤銷成功。
六、鎖定與解鎖:
alter user muniu account lock;
alter user muniu account unlock;
SQL>
SQL> alter user muniu account lock;
用戶已更改。
SQL> alter user muniu account unlock;
用戶已更改。
七、Oracle的角色:
Oracle中的角色可以給特定的用戶特定的權限,通過角色的方式可以批量授權。
1、創建角色:
create role bike;
2、給角色授權:
grant connect to bike;
3、刪除角色:
drop role bike;
SQL> create role bike;
角色已創建。
SQL> grant connect to bike;
授權成功。
SQL> drop role bike;
角色已刪除。
八、刪除用戶
drop user muniu cascade;
SQL> drop user muniu;
用戶已刪除。
SQL> drop user liuma cascade;
用戶已刪除。
九、Oracle的架構:
數據庫實例(orcl)///user用戶///對象
類似與Mysql中:
Mysql///database///table
不積跬步,無以至千里…