ORACLE SQL总结六:管理方案对象

1、SET UNUSED COLUMNS的若干问题

1.1 UNUSED后,所有的索引、约束和静态定义都被移除。

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

2、external table 外部表的特点

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

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.

3、FLASHBACK TABLE

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.

4、index的其他问题

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

5、数据库非正常关机中的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.

那些已经被使用但还没有被保存的序列数字也会丢失。(问题:这里的保存怎么理解)

6、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>

转载于:https://my.oschina.net/kursk/blog/67763

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值