show user; USER is S..."/>
溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

Oracle菜鳥(niǎo)學(xué)習(xí)之 Oracle基礎(chǔ)命令

發(fā)布時(shí)間:2020-07-11 22:43:21 來(lái)源:網(wǎng)絡(luò) 閱讀:445 作者:運(yùn)維少年 欄目:關(guān)系型數(shù)據(jù)庫(kù)

首發(fā):http://www.arppinging.com/wordpress/?p=93

Oracle菜鳥(niǎo)學(xué)習(xí)之 Oracle基礎(chǔ)命令

1.connect和show user

連接用戶(hù)和查看當(dāng)前用戶(hù)

SQL> show user;
USER is "SCOTT"
SQL> conn /as sysdba
Connected.
SQL> show user
USER is "SYS"
SQL> 

2.clear screen

清除屏幕輸出

3.spool

記錄輸出內(nèi)容到文本

開(kāi)啟記錄
SQL> spool /tmp/sql.txt
SQL> select * from student;

       SNO SNAME                          BIRTHDAY
---------- ------------------------------ -------------------
         1 A                              0011-01-01 00:00:00
         2 B                              2011-01-01 00:00:00
         3                                1981-02-23 00:00:00
         4 D

SQL> spool off
#關(guān)閉記錄
# 查看文本是否有記錄內(nèi)容
[root@localhost tmp]# cat /tmp/sql.txt 
SQL> select * from student;

       SNO SNAME                          BIRTHDAY                              
---------- ------------------------------ -------------------                   
         1 A                              0011-01-01 00:00:00                   
         2 B                              2011-01-01 00:00:00                   
         3                                1981-02-23 00:00:00                   
         4 D                                                                    

SQL> spool off
[root@localhost tmp]# 

4.set time on

將時(shí)間信息打印在提示符的左邊

#開(kāi)啟時(shí)間顯示
SQL> set time on
16:02:39 SQL> 
16:02:41 SQL> set time off
# 關(guān)閉時(shí)間顯示
SQL> 

5.host

host可以執(zhí)行l(wèi)inux或者windows的命令

SQL> host ls -l
total 40
-rw-r--r--. 1 oracle oinstall   20 Oct  3 12:59 afiedt.buf
drwxr-xr-x. 2 oracle oinstall 4096 Oct  2 10:54 Desktop
drwxr-xr-x. 2 oracle oinstall 4096 Oct  2 10:54 Documents
drwxr-xr-x. 2 oracle oinstall 4096 Oct  2 10:54 Downloads
drwxr-xr-x. 2 oracle oinstall 4096 Oct  2 10:54 Music
drwxr-x---. 3 oracle oinstall 4096 Oct  2 11:28 oradiag_oracle
drwxr-xr-x. 2 oracle oinstall 4096 Oct  2 10:54 Pictures
drwxr-xr-x. 2 oracle oinstall 4096 Oct  2 10:54 Public
drwxr-xr-x. 2 oracle oinstall 4096 Oct  2 10:54 Templates
drwxr-xr-x. 2 oracle oinstall 4096 Oct  2 10:54 Videos

SQL> 

6.@

@在oracle中可以用來(lái)執(zhí)行腳本中的內(nèi)容

# 查看腳本信息
[root@localhost tmp]# cat test.sql 
select * from student;
show user;
[root@localhost tmp]# 
# 執(zhí)行腳本
SQL> @/tmp/test.sql

       SNO SNAME                          BIRTHDAY
---------- ------------------------------ -------------------
         1 A                              0011-01-01 00:00:00
         2 B                              2011-01-01 00:00:00
         3                                1981-02-23 00:00:00
         4 D

USER is "SCOTT"
SQL> 
向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI