sqlplus簡單使用


登錄

C:\Users\inmeditation>sqlplus
請輸入用戶名:  scott
輸入口令:

查看當前行長

SQL> show linesize;
linesize 80

查看當前頁長

SQL> show pagesize;
pagesize 14

設置行長和頁長

SQL> set linesize 100;
SQL> set pagesize 20;
SQL> show pagesize;
pagesize 20

查看當前所在用戶

SQL> show user;
USER 為 "SCOTT"

更改當前用戶的密碼

SQL> alter user scott identified by scottpw;

用戶已更改。

通過交互方式更改當前用戶密碼

SQL> passw
更改 SCOTT 的口令
舊口令:
新口令:
重新鍵入新口令:
口令已更改

切換到超級用戶

SQL> conn sys as sysdba
輸入口令:
已連接。
SQL> conn system/sys
已連接。

解鎖scott用戶

SQL> alter user scott account unlock;
用戶已更改。

強制更改scott賬戶的密碼

SQL> alter user scott identified by scottpw;
用戶已更改。

退出當前數據庫

SQL> disc
從 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> show user;
USER 為 ""

退出數據庫

SQL> exit
C:\Users\inmeditation>
SQL> quit
從 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options 斷開

C:\Users\inmeditation>

授權給scott用戶 權限

SQL> grant connect,resource to scott;
授權成功。

SQL> grant select any dictionary to scott;
授權成功。

在scott中執行命令查詢表結構

select a.OWNER 建表用戶,
       a.TABLE_NAME 表名,
       a.COLUMN_NAME 列名,
       a.DATA_TYPE 數據類型,
       a.DATA_LENGTH 默認長度,
       a.DATA_PRECISION 最大長度,
       a.DATA_SCALE 小數位數,
       a.NULLABLE 可否為空,
       a.COLUMN_ID 列ID
from DBA_TAB_COLUMNS a
where a.TABLE_NAME = 'EMP'
order by a.COLUMN_ID asc;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM