oracle10g new feature -- 1. Sqlplus
這些天一直在學習oracle10g的一些新特性,順便作了一些筆記。把它們都陸續放到這上面來吧。
雖然網上oracle10g新特性的資料很多,自己看過,測試過,自己做的筆記畢竟不一樣,回頭來看快。
按自己的順序,第一章,SQLPLUS
[@more@]1. Prompts for the Unmindful set sqlprompt "_user _privilege> "
The SQL*Plus prompt shows up as
SYS AS SYSDBA>
SQL> set sqlprompt "_user _privilege 'on' _date >"
SYS AS SYSDBA on 06-JAN-04 >
SQL> set sqlprompt "_user 'on' _date 'at' _connect_identifier >"
ANANDA on 06-JAN-04 at SMILEY >
ANANDA on 06-JAN-04 at SMILEY > alter session set nls_date_format = 'mm/dd/yyyy hh24:mi:ss';
Session altered.
ANANDA on 01/06/2004 13:03:51 at SMILEY >
2. Quote the Obvious? Why, No!
Oracle 9i: $sqlplus "/ as sysdba"
Oracle 10g: $ sqlplus / as sysdba
3. Improved File Manipulations To save scripts
In previous versions:
select something1 ....
save c:testf1.sql
select something else ....
save c:testf2.sql
select yet another thing ....
save c:testf3.sql
In Oracle 10g:
select something1 ....
save myscripts
select something else ....
save myscripts append
select yet another thing ....
save myscripts append
In spool, if u don’t want to silently overwrite the existed output Result.lst file,
APPEND:
SQL>spool result.lst append
check the existence of the file before writing:
SQL> spool result.lst create
Use another name or "SPOOL filename[.ext] REPLACE"
Just OVERWRITE
SQL> spool result.lst
Or
SQL>spool result.lst replace
4. Login.sql is for Logins, Isn't It? In oracle9i and below, login.sql file was not executed at connect time, but only at the SQL*Plus startup time. So,
SQL>set sqlprompt "_connect_identifier >"
DB1>
DB1> connect scott/tiger@db2
Connected
DB1> --“Wrong prompt”
In oracle10g, The file login.sql is not only executed at SQL*Plus startup time, but at connect time as well:
SCOTT at DB1> connect scott/tiger@db2
SCOTT at DB2> connect john/meow@db3
JOHN at DB3> “Correct prompt”
5. Shift back to sqlplus 9i
$Sqlplus –c 9.2
6. Use DUAL Freely Suppose SQL:
SQL>select USER into from DUAL;
Because DUAL is a special table, the consistent gets are considerably reduced and the optimization plan is different as seen from the event 10046 trace.
In Oracle9i
Rows Execution Plan
------- --------------------------------------------------
0 SELECT STATEMENT GOAL: CHOOSE
1 TABLE ACCESS (FULL) OF 'DUAL'
In 10g
Rows Execution Plan
------- --------------------------------------------------
0 SELECT STATEMENT MODE: ALL_ROWS
0 FAST DUAL
Notice the use of the new FAST DUAL optimization plan, as opposed to the FULL TABLE SCAN of DUAL in Oracle9i. This improvement reduces the consistent reads significantly, benefiting applications that use the DUAL table frequently.
To save scripts
In previous versions:
select something1 ....
save c:testf1.sql
select something else ....
save c:testf2.sql
select yet another thing ....
save c:testf3.sql
In Oracle 10g:
select something1 ....
save myscripts
select something else ....
save myscripts append
select yet another thing ....
save myscripts append
In spool, if u don’t want to silently overwrite the existed output Result.lst file,
APPEND:
SQL>spool result.lst append
check the existence of the file before writing:
SQL> spool result.lst create
Use another name or "SPOOL filename[.ext] REPLACE"
Just OVERWRITE
SQL> spool result.lst
Or
SQL>spool result.lst replace
4. Login.sql is for Logins, Isn't It? In oracle9i and below, login.sql file was not executed at connect time, but only at the SQL*Plus startup time. So,
SQL>set sqlprompt "_connect_identifier >"
DB1>
DB1> connect scott/tiger@db2
Connected
DB1> --“Wrong prompt”
In oracle10g, The file login.sql is not only executed at SQL*Plus startup time, but at connect time as well:
SCOTT at DB1> connect scott/tiger@db2
SCOTT at DB2> connect john/meow@db3
JOHN at DB3> “Correct prompt”
5. Shift back to sqlplus 9i
$Sqlplus –c 9.2
6. Use DUAL Freely Suppose SQL:
SQL>select USER into from DUAL;
Because DUAL is a special table, the consistent gets are considerably reduced and the optimization plan is different as seen from the event 10046 trace.
In Oracle9i
Rows Execution Plan
------- --------------------------------------------------
0 SELECT STATEMENT GOAL: CHOOSE
1 TABLE ACCESS (FULL) OF 'DUAL'
In 10g
Rows Execution Plan
------- --------------------------------------------------
0 SELECT STATEMENT MODE: ALL_ROWS
0 FAST DUAL
Notice the use of the new FAST DUAL optimization plan, as opposed to the FULL TABLE SCAN of DUAL in Oracle9i. This improvement reduces the consistent reads significantly, benefiting applications that use the DUAL table frequently.
Suppose SQL:
SQL>select USER into
Because DUAL is a special table, the consistent gets are considerably reduced and the optimization plan is different as seen from the event 10046 trace.
In Oracle9i
Rows Execution Plan
------- --------------------------------------------------
0 SELECT STATEMENT GOAL: CHOOSE
1 TABLE ACCESS (FULL) OF 'DUAL'
In 10g
Rows Execution Plan
------- --------------------------------------------------
0 SELECT STATEMENT MODE: ALL_ROWS
0 FAST DUAL
Notice the use of the new FAST DUAL optimization plan, as opposed to the FULL TABLE SCAN of DUAL in Oracle9i. This improvement reduces the consistent reads significantly, benefiting applications that use the DUAL table frequently.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/207/viewspace-778590/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle10g New Feature -- 8. Tablespace ManagementOracle
- Oracle10g New Feature -- 4. Flashback DatabaseOracleDatabase
- Oracle10g New Feature -- 3.Flashback TableOracle
- Oracle10g New Feature -- 2.Flashback RecordsOracle
- Oracle10g New Feature -- 11. Wait InterfaceOracleAI
- Oracle10g New Feature -- 7. Rollback MonitoringOracle
- Oracle10g New Feature -- 6. Oracle Data PumpOracle
- Oracle10g New Feature -- 5.Temporary Tablespace GroupOracle
- Oracle10g New Feature:CRS(Cluster Ready Services) (zt)Oracle
- Oracle10g New Feature -- 9. ASM (Automatic Storage Management)OracleASM
- java new featureJava
- Oracle10g New Feature -- 14. OEM ( Oracle Enterprise Manager)Oracle
- Oracle10g New Feature -- 13. Automatic Shared Memory ManagementOracle
- Oracle10g New Feature --12. ASSM ( Automatic Segment Space Management )OracleSSM
- Oracle10g New Feature -- 10. AWR (Automatic Workload Repository)Oracle
- oracle10g new feature:對expdp並行方式的幾個測試Oracle並行
- 12c new feature
- 版本新特性(new feature)
- new feature ——>mysql to oracle MigrationMySqlOracle
- Oracle Database 12C New FeatureOracleDatabase
- 11g New Feature: Health monitor
- Oracle 12c Recover Table New FeatureOracle
- oracle 12c new feature 列不可見Oracle
- sqlplus之prompt_&&_&_new_valueSQL
- j2ee1.4 new feature請教banq
- Oracle10g New Features(1)Oracle
- Oracle10g sqlplus小改進OracleSQL
- 11g New Feature: Health monitor (Doc ID 466920.1)
- oracle 11g ocp new feature 1z0-050Oracle
- Test Negtive Role Set in a stream environmnet- 10g_new_feature
- oracle 12cR2 new feature dbca 命令可以建立standby 庫Oracle
- Does Goldengate Support The New Oracle 10g Flashback Feature? [ID 966212.1]GoOracle 10g
- New redo log sizing advisor in Oracle10gOracle
- Oracle10g在Linux下sqlplus無響應OracleLinuxSQL
- oracle10g sqlplus--工具的選項測試OracleSQL
- zt_楊老師yangtingkun_11g new feature新特性系列文章
- oracle 12c R2 new feature 支援執行過的歷史命令Oracle
- oracle 12c new feature crsctl 停止資源時提供預覽確認功能Oracle