Oracle自学笔记(一)
时间:2014-05-08 12:18:54
收藏:0
阅读:412
1、创建用户并指定表空间
create user gy_3004 identified by gy_3004 default tablespace gy_3004_data temporary tablespace gy_3004_temp;
2、给用户授予权限
--方式一: GRANT CREATE SESSION, CREATE ANY TABLE, CREATE ANY VIEW ,CREATE ANY INDEX,CREATE ANY PROCEDURE, ALTER ANY TABLE, ALTER ANY PROCEDURE, DROP ANY TABLE, DROP ANY VIEW, DROP ANY INDEX, DROP ANY PROCEDURE, SELECT ANY TABLE, INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY TABLE TO GY_3004; --方式二: grant connect,resource,dba to gy_3004;
3、创建临时表空间
create temporary tablespace MyTableSpace_temp tempfile ‘D:\Oracle_11g\oradata\orcl\MyTableSpace_temp.dbf‘ size 5M autoextend on next 1M maxsize 5m extent management local;
4、创建数据表空间
create tablespace MyTableSpace_data logging datafile ‘D:\Oracle_11g\oradata\orcl\MyTableSpace_data.dbf‘ size 5m autoextend on next 1m maxsize 5m extent management local;
5、查询数据库名
select name from v$database; select instance_name from v$instance;
6、查询系统表空间
select tablespace_name from dba_tablespaces;
7、删除用户
drop user gy_3004 cascade;
8、删除表空间
drop tablespace gy_3004_temp including contents; drop tablespace gy_3004_data including contents;
9、查看表空间剩余大小
select tablespace_name,sum(bytes),max(bytes) from dba_free_space group by tablespace_name;
10、查看用户
SELECT * FROM DBA_USERS; SELECT * FROM ALL_USERS; SELECT * FROM USER_USERS;
评论(0)