ORACLE中常見SET指令,ORACLE常見SET指令

來源:互聯網
上載者:User

ORACLE中常見SET指令,ORACLE常見SET指令



1         SET TIMING ON

說明:顯示SQL語句的已耗用時間。預設值為OFF。

在SQLPLUS中使用,時間精確到0.01秒。也就是10毫秒。

在PL/SQL DEVELOPER中,時間精確到0.001秒:

2         SET AUTOTRACE ON

說明:設定允許對執行的SQL進行分析。預設值為OFF。

SET AUTOTRACE OFF:不產生AUTOTRACE報告,這是預設模式
SET AUTOTRACE ON EXPLAIN:AUTOTRACE只顯示最佳化器執行路徑報告
SET AUTOTRACE ON STATISTICS:只顯示執行統計資訊
SET AUTOTRACE ON:包含執行計畫和統計資訊
SET AUTOTRACE TRACEONLY:同SET AUTOTRACE ON,但是不顯示查詢輸出 

3         SET TRIMOUT ON

去除標準輸出每行的拖尾空格,預設為OFF

4         SET TRIMSPOOL ON

去除重新導向(SPOOL)輸出每行的拖尾空格,預設為OFF

5         SET ECHO ON

顯示START啟動的指令碼中的每個SQL命令,預設為ON

6         SET FEEDBACK ON

設定顯示“已選擇XX行”

顯示本次SQL命令處理的記錄條數,預設為ON

7         SET COLSEP ' '

輸出資料行之間的分隔字元。

8         SET HEADING OFF

輸出域標題,預設為on

 

 

9         SET PAGESIZE 0

輸出每頁行數,預設為24,為了避免分頁,可設定為0。

 

10    SET LINESIZE 80

 輸出一行字元個數,預設為80

 

11    SET NUMWIDTH 12

輸出NUMBER類型域長度,預設為10

 

12    SET TERMOUT OFF

顯示指令碼中的命令的執行結果,預設為ON

 

13    SET SERVEROUTPUT ON

設定允許顯示輸出類似DBMS_OUTPUT

size 10000000

 

14    SET VERIFY OFF                    

可以關閉和開啟提示確認資訊old 1和new 1的顯示.


oracle 常用命令

baike.baidu.com/view/1239908.htm

SQL Plus 的命令, 差不多都在上面這個網頁裡面了。

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| sqldoc |
| test |
+--------------------+
4 rows in set (0.00 sec)

Oracle 一個執行個體,就是一個資料庫, 所以,沒有對應的 show databases 語句

mysql> show tables
-> ;
+----------------+
| Tables_in_test |
+----------------+
| sale_report |
| test_dysql |
| union_tab_1 |
| union_tab_2 |
| v_sale_report |
+----------------+
5 rows in set (0.00 sec)

Oracle 使用下面的語句實現

SQL> SELECT
2 table_name
3 FROM
4 all_tables
5 WHERE
6 ROWNUM < 10;

TABLE_NAME
------------------------------------------------------------
ICOL$
CON$
UNDO$
PROXY_ROLE_DATA$
FILE$
UET$
IND$
SEG$
COL$

9 rows selected.

mysql> desc sale_report;
+------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------+------+-----+---------+-------+
| SALE_DATE | datetime | NO | | NULL | |
| SALE_ITEM | varchar(2) | NO | | NULL | |
| SALE_MONEY | decimal(10,2) | NO | | NULL | |
+------------+---------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

Oracle

SQL> desc all_tab_columns
Name ......餘下全文>>
 
Oracle常見的命令

太多了, 下面的只是一小部分oracle常用命令(我的筆記)
oracle裡常用命令第一章:日誌管理 1.forcing log switches
sql> alter system switch logfile;
2.forcing checkpoints
sql> alter system checkpoint;
3.adding online redo log groups
sql> alter database add logfile [group 4]
sql> ('/disk3/log4a.rdo','/disk4/log4b.rdo') size 1m;
4.adding online redo log members
sql> alter database add logfile member
sql> '/disk3/log1b.rdo' to group 1,
sql> '/disk4/log2b.rdo' to group 2;
5.changes the name of the online redo logfile
sql> alter database rename file 'c:/oracle/oradata/oradb/redo01.log'
sql> to 'c:/oracle/oradata/redo01.log';
6.drop online redo log groups
sql> alter database drop logfile group 3;
7.drop online redo log members
sql> alter database drop logfile member 'c:/oracle/oradata/redo01.log';
8.clearing online redo log files
sql> alter database clear [unarchived] logfile 'c:/oracle/log2a.rdo';
9.using logminer analyzing redo logfiles
a. in the init.ora specify utl_file_dir = ' '
b. sql> execute dbms_logmnr_d.build('oradb.ora','c:\oracle\oradb\log');
c. sql> execute dbms_logmnr_add_logfile('c:\oracle\oradata\oradb\redo01.log',
sql> dbms_logmnr.new);
d. sql> execute dbms_logmnr.add_logfile('c:\oracle\oradata\oradb\redo02.log&#3......餘下全文>>
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.