Oracle 建立表空间和用户 \ 导出和导入 数据表
2017-01-01 22:43
477 查看
Oracle建立表空间和用户
[sql] view plain copy
建立表空间和用户的步骤:
用户
建立:create user 用户名 identified by "密码";
授权:grant create session to 用户名;
grant create table to 用户名;
grant create tablespace to 用户名;
grant create view to 用户名;
grant
connect,resource to user;
[sql] view plain copy
表空间
建立表空间(一般建N个存数据的表空间和一个索引空间):
create tablespace 表空间名
datafile ' 路径(要先建好路径)\***.dbf ' size *M
tempfile ' 路径\***.dbf ' size *M
autoextend on --自动增长
--还有一些定义大小的命令,看需要
default storage(
initial 100K,
next 100k,
);
[sql] view plain copy
例子:创建表空间
create tablespace DEMOSPACE
datafile 'E:/oracle_tablespaces/DEMOSPACE_TBSPACE.dbf'
PS:此处需要注意 ,创建表空间需要在oracle 数据库安装目录下D:\oracle\product\11.2.0\dbhome_1 创建,创建在别目录也可以,但是需要对目录设置权限(oracle 11g) 语法自己百度,本人使用这一种。
size 1500M
autoextend on next 5M maxsize 3000M; //此处是语句结束
删除表空间
drop tablespace DEMOSPACE including contents and datafiles
=============================================================
[sql] view plain copy
例子:创建表空间
create tablespace DEMOSPACE
datafile 'E:/oracle_tablespaces/DEMOSPACE_TBSPACE.dbf'
size 1500M
autoextend on next 5M maxsize 3000M;
删除表空间
drop tablespace DEMOSPACE including contents and datafiles
=============================================================
[sql] view plain copy
用户权限
授予用户使用表空间的权限:
alter user 用户名 quota unlimited on 表空间;
或 alter user 用户名 quota *M on 表空间;
完整例子:
[sql] view plain copy
--表空间
CREATE TABLESPACE sdt
DATAFILE 'F:\tablespace\demo' size 800M
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
--索引表空间
CREATE TABLESPACE sdt_Index
DATAFILE 'F:\tablespace\demo' size 512M
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
--2.建用户
create user demo identified by demo
default tablespace demo;
--3.赋权
grant connect,resource to demo;
grant create any sequence to demo;
grant create any table to demo;
grant delete any table to demo;
grant insert any table to demo;
grant select any table to demo;
grant unlimited tablespace to demo;
grant execute any procedure to demo;
grant update any table to demo;
grant create any view to demo;
[sql] view plain copy
--导入导出命令
ip导出方式: exp demo/demo@127.0.0.1:1521/orcl file=f:/f.dmp full=y
exp demo/demo@orcl file=f:/f.dmp full=y
imp demo/demo@orcl file=f:/f.dmp full=y ignore=y
转自:http://blog.csdn.net/starnight_cbj/article/details/6792364
========================================================
Oracle安装完后,其中有一个缺省的数据库,除了这个缺省的数据库外,我们还可以创建自己的数据库。
对于初学者来说,为了避免麻烦,可以用'Database Configuration Assistant'向导来创建数据库。
创建完数据库后,并不能立即在数据库中建表,必须先创建该数据库的用户,并且为该用户指定表空间。
下面是创建数据库用户的具体过程:
1.假如现在已经建好名为'news'的数据库,此时在F:\oracle\product\10.1.0\oradata\目录下已经存在news目录(注意:我的Oracle10g安装在F:\oracle下,若你的Oracle安装在别的目录,那么你新建的数据库目录就在*\product\10.1.0\oradata\目录下)。
2.在创建用户之前,先要创建表空间:
其格式为:格式: create tablespace 表间名 datafile '数据文件名' size 表空间大小;
如:
SQL> create tablespace news_tablespace datafile 'D:\oracle\product\10.1.0\oradata\news\news_data.dbf'
size 500M;
其中'news_tablespace'是你自定义的表空间名称,可以任意取名;'F:\oracle\product\10.1.0\oradata\news\news_data.dbf'是数据文件的 存放位置,'news_data.dbf'文件名也是任意取;'size 500M'是指定该数据文件的大小,也就是表空间的大小。
3.现在建好了名为'news_tablespace'的表空间,下面就可以创建用户了:
其格式为:格式: create user 用户名 identified by 密码 default tablespace 表空间表;
如:
SQL> create user news identified by news default tablespace news_tablespace;
默认表空间'default tablespace'使用上面创建的表空间。
4.接着授权给新建的用户:
SQL> grant connect,resource to news; --表示把 connect,resource权限授予news用户
SQL> grant dba to news; --表示把 dba权限授予给news用户
授权成功。
转自:http://www.cnblogs.com/Percy_Lee/p/5051156.html
[sql] view plain copy
建立表空间和用户的步骤:
用户
建立:create user 用户名 identified by "密码";
授权:grant create session to 用户名;
grant create table to 用户名;
grant create tablespace to 用户名;
grant create view to 用户名;
grant
connect,resource to user;
[sql] view plain copy
表空间
建立表空间(一般建N个存数据的表空间和一个索引空间):
create tablespace 表空间名
datafile ' 路径(要先建好路径)\***.dbf ' size *M
tempfile ' 路径\***.dbf ' size *M
autoextend on --自动增长
--还有一些定义大小的命令,看需要
default storage(
initial 100K,
next 100k,
);
[sql] view plain copy
例子:创建表空间
create tablespace DEMOSPACE
datafile 'E:/oracle_tablespaces/DEMOSPACE_TBSPACE.dbf'
PS:此处需要注意 ,创建表空间需要在oracle 数据库安装目录下D:\oracle\product\11.2.0\dbhome_1 创建,创建在别目录也可以,但是需要对目录设置权限(oracle 11g) 语法自己百度,本人使用这一种。
size 1500M
autoextend on next 5M maxsize 3000M; //此处是语句结束
删除表空间
drop tablespace DEMOSPACE including contents and datafiles
=============================================================
[sql] view plain copy
例子:创建表空间
create tablespace DEMOSPACE
datafile 'E:/oracle_tablespaces/DEMOSPACE_TBSPACE.dbf'
size 1500M
autoextend on next 5M maxsize 3000M;
删除表空间
drop tablespace DEMOSPACE including contents and datafiles
=============================================================
[sql] view plain copy
用户权限
授予用户使用表空间的权限:
alter user 用户名 quota unlimited on 表空间;
或 alter user 用户名 quota *M on 表空间;
完整例子:
[sql] view plain copy
--表空间
CREATE TABLESPACE sdt
DATAFILE 'F:\tablespace\demo' size 800M
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
--索引表空间
CREATE TABLESPACE sdt_Index
DATAFILE 'F:\tablespace\demo' size 512M
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
--2.建用户
create user demo identified by demo
default tablespace demo;
--3.赋权
grant connect,resource to demo;
grant create any sequence to demo;
grant create any table to demo;
grant delete any table to demo;
grant insert any table to demo;
grant select any table to demo;
grant unlimited tablespace to demo;
grant execute any procedure to demo;
grant update any table to demo;
grant create any view to demo;
[sql] view plain copy
--导入导出命令
ip导出方式: exp demo/demo@127.0.0.1:1521/orcl file=f:/f.dmp full=y
exp demo/demo@orcl file=f:/f.dmp full=y
imp demo/demo@orcl file=f:/f.dmp full=y ignore=y
转自:http://blog.csdn.net/starnight_cbj/article/details/6792364
========================================================
Oracle安装完后,其中有一个缺省的数据库,除了这个缺省的数据库外,我们还可以创建自己的数据库。
对于初学者来说,为了避免麻烦,可以用'Database Configuration Assistant'向导来创建数据库。
创建完数据库后,并不能立即在数据库中建表,必须先创建该数据库的用户,并且为该用户指定表空间。
下面是创建数据库用户的具体过程:
1.假如现在已经建好名为'news'的数据库,此时在F:\oracle\product\10.1.0\oradata\目录下已经存在news目录(注意:我的Oracle10g安装在F:\oracle下,若你的Oracle安装在别的目录,那么你新建的数据库目录就在*\product\10.1.0\oradata\目录下)。
2.在创建用户之前,先要创建表空间:
其格式为:格式: create tablespace 表间名 datafile '数据文件名' size 表空间大小;
如:
SQL> create tablespace news_tablespace datafile 'D:\oracle\product\10.1.0\oradata\news\news_data.dbf'
size 500M;
其中'news_tablespace'是你自定义的表空间名称,可以任意取名;'F:\oracle\product\10.1.0\oradata\news\news_data.dbf'是数据文件的 存放位置,'news_data.dbf'文件名也是任意取;'size 500M'是指定该数据文件的大小,也就是表空间的大小。
3.现在建好了名为'news_tablespace'的表空间,下面就可以创建用户了:
其格式为:格式: create user 用户名 identified by 密码 default tablespace 表空间表;
如:
SQL> create user news identified by news default tablespace news_tablespace;
默认表空间'default tablespace'使用上面创建的表空间。
4.接着授权给新建的用户:
SQL> grant connect,resource to news; --表示把 connect,resource权限授予news用户
SQL> grant dba to news; --表示把 dba权限授予给news用户
授权成功。
转自:http://www.cnblogs.com/Percy_Lee/p/5051156.html
相关文章推荐
- Oracle建立表空间和用户、数据导入导出
- Oracle对数据的导出和导入,建立用户,删除用户以及其下的所有表
- oracle创建删除表空间、用户、数据导入导出等常用sql语句
- oracle 11g linux 建立表空间 用户 授权 数据导入 导出
- Oracle建立表空间用户以及dmp文件导入导出
- Oracle对数据的导出和导入,建立用户,删除用户以及其下的所有表
- oracle创建删除表空间、用户、数据导入导出等常用sql语句
- oracle建立表空间用户,导入导出命令
- Oracle对数据的导出和导入,建立用户,删除用户以及其下的所有表
- Oracle创建表空间和用户-导入导出
- oracle 11g linux 建立表空间 用户 授权 数据库导入导出
- oracle按用户导入导出数据
- ORACLE创建表空间、删除用户与建立用户及权限及导入导出脚本
- Oracle中不同用户间数据的导入导出
- oracle 11g linux 建立表空间 用户 授权 数据库导入导出
- ORACLE (不同用户)(不同表)数据导出和导入
- Oracle 导出、导入某用户所有数据(包括表、视图、存储过程...)
- linux oracle创建用户,导入导出数据。
- Oracle中不同用户间数据的导入导出[1]
- oracle 表空间、临时表空间、创建用户、导入数据、导出数据