ORACLE SQL總結六:管理方案對象

一、SET UNUSED COLUMNS的若干問題sql

1.1 UNUSED後,全部的索引、約束和靜態定義都被移除。數據庫

All constraints, indexes, and statistics defined on the column are also removed.app

二、external table 外部表的特色ui

Oracle Database allows you read-only access to data in external tables.rest

You can select, join, or sort external table data. You can also create views and synonyms for external tables. However, no DML operations (UPDATE, INSERT, or DELETE) are possible, and no indexes can be created, on external tables.code

三、FLASHBACK TABLEorm

3.1 Use the FLASHBACK TABLE statement to restore an earlier state of a table in the event of human or application error. The time in the past to which the table can be flashed back is dependent on the amount of undo data in the system. Also, Oracle Database cannot restore a table to an earlier state across any DDL operations that change the structure of the table.對象

3.2 You cannot roll back a FLASHBACK TABLE statement. However, you can issue another FLASHBACK TABLE statement and specify a time just prior to the current time. Therefore, it is advisable to record the current SCN before issuing a FLASHBACK TABLE clause.索引

四、index的其餘問題ip

4.1 當指定主鍵後,不能再在主鍵上建索引,由於ORACLE 已經自動建了索引。即不能在一個列上建多個索引。

例子以下,table ord 的主鍵是ord_no

SQL> create index ord_idx on ord(ord_no);
create index ord_idx on ord(ord_no)
                            *
ERROR at line 1:
ORA-01408: such column list already indexed

五、數據庫非正常關機中的sequence

The database might skip sequence numbers if you choose to cache a set of sequence numbers. For example, when an instance abnormally shuts down (for example, when an instance failure occurs or a SHUTDOWN ABORT statement is issued), sequence numbers that have been cached but not used are lost. Also, sequence numbers that have been used but not saved are lost as well. The database might also skip cached sequence numbers after an export and import

sequence numbers that have been used but not saved are lost as well.

那些已經被使用但尚未被保存的序列數字也會丟失。(問題:這裏的保存怎麼理解)

六、private synonym 和public synonym 區別

private synonym:只有有該對象訪問權限的用戶才能訪問這個對象的synonym

public synonym:全部用戶都能訪問該synonym

示例:

SQL> conn test/test;
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0 
Connected as test

SQL> select count(*) from hr.employees;

  COUNT(*)
----------
       107

SQL> create synonym employees for hr.employees;

Synonym created

SQL> select count(*) from employees;

  COUNT(*)
----------
       107

SQL> conn sys/111 as sysdba;
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0 
Connected as SYS

SQL> select count(1) from employees;

select count(1) from employees

ORA-00942: 表或視圖不存在

SQL> conn test/test;
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0 
Connected as test

SQL> drop synonym employees;

Synonym dropped

SQL> create public synonym employees for hr.employees;

Synonym created

SQL> select count(*) from employees;

  COUNT(*)
----------
       107

SQL> conn sys/111 as sysdba;
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0 
Connected as SYS

SQL> select count(*) from employees;

  COUNT(*)
----------
       107

SQL>
相關文章
相關標籤/搜索