/*A schema is a collection of database objects that are owned by a particular user. Typically,
for a production database, this user does not represent a person, but an application. A
schema has the same name as the user that owns the schema. Schema objects are the
logical structures that directly refer to database’s data. Schema objects include structures
such as tables, views, and indexes.*/
Select * From A.Tt --这里的A代表的就是schema A,不是user A
Select Distinct sid From v$mystat --159
Select username,schemaname From v$session Where sid=159 --username sys;schemaname sys
Alter Session Set Current_Schema=A --改变当前SESSION的schema为A,SESSION和schema是可以不同的
Select username,schemaname From v$session Where sid=159 --username sys;schemaname A
Select * From tt --此时访问TT表不需要加A.作为前缀,所以A.Tt中的A.是schema的名字
/*Select * From Dba_Users Where username = 'A'
Select * From Dba_OBJECTS Where OBJECT_NAME Like 'DBA_%PRIVS'
Select * From DBA_ROLE_PRIVS Where GRANTEE='A'*/
--***********trigger 触发器 SYS用户不能创建,需要用其他用户
/*Create Or Replace Trigger trigger_test
After Ddl On A.Schema --体现schema的作用,对A下所有对象做DDL操作都会触发该触发器
Declare
......; --省略处理过程
End;*/
--*********sequence
/*CREATE SEQUENCE seq1
START WITH 100
INCREMENT BY 10
MAXVALUE 200
CYCLE
NOCACHE.
The sequence SEQ1 has generated numbers up to the maximum limit of 200. You issue the following
SQL statement:
SELECT seq1.nextval FROM dual.
What is displayed by the SELECT statement?
Answer: 1*/
for a production database, this user does not represent a person, but an application. A
schema has the same name as the user that owns the schema. Schema objects are the
logical structures that directly refer to database’s data. Schema objects include structures
such as tables, views, and indexes.*/
Select * From A.Tt --这里的A代表的就是schema A,不是user A
Select Distinct sid From v$mystat --159
Select username,schemaname From v$session Where sid=159 --username sys;schemaname sys
Alter Session Set Current_Schema=A --改变当前SESSION的schema为A,SESSION和schema是可以不同的
Select username,schemaname From v$session Where sid=159 --username sys;schemaname A
Select * From tt --此时访问TT表不需要加A.作为前缀,所以A.Tt中的A.是schema的名字
/*Select * From Dba_Users Where username = 'A'
Select * From Dba_OBJECTS Where OBJECT_NAME Like 'DBA_%PRIVS'
Select * From DBA_ROLE_PRIVS Where GRANTEE='A'*/
--***********trigger 触发器 SYS用户不能创建,需要用其他用户
/*Create Or Replace Trigger trigger_test
After Ddl On A.Schema --体现schema的作用,对A下所有对象做DDL操作都会触发该触发器
Declare
......; --省略处理过程
End;*/
--*********sequence
/*CREATE SEQUENCE seq1
START WITH 100
INCREMENT BY 10
MAXVALUE 200
CYCLE
NOCACHE.
The sequence SEQ1 has generated numbers up to the maximum limit of 200. You issue the following
SQL statement:
SELECT seq1.nextval FROM dual.
What is displayed by the SELECT statement?
Answer: 1*/
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15810196/viewspace-1130236/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15810196/viewspace-1130236/