oracle 创建表空间 用户 数据库导入imp和导出exp
1. pl/sql
客户机安装后还要配置tnsnames.ora文件,在oracle客户端安装目录的network的admin目录下
内容类似下面:
ORADB =
(DEs criptION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.2 )(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oradb)
)
)
具体例子:
192.168.1.2 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.13.35)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcaletest) ) )
//SERVICE_NAME 为数据库实例名
2.pl/sql登陆之后,开始创建表空间以及用户;
//创建表空间
create tablespace test_users
logging
datafile 'D:\oracle\ora92\oradata\test_users_idx.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
create tablespace test_interface
logging
datafile 'D:\oracle\ora92\oradata\test_interface_idx.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
create tablespace test_business
logging
datafile 'D:\oracle\ora92\oradata\test_business_idx.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
create tablespace test_account
logging
datafile 'D:\oracle\ora92\oradata\test_account_idx.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
create tablespace test_ticket
logging
datafile 'D:\oracle\ora92\oradata\test_ticket_idx.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
//创建数据库用户
create user yangdaliang identified by 123456;
其中 yangdaliang 为数据库用户名 123456 为密码;
//为创建的数据库用户授权
grant connect to yangdaliang;
grant dba to yangdaliang;
grant imp_full_database to yangdaliang;
grant resource to yangdaliang;
grant create session to yangdaliang;
grant unlimited tablespace to yangdaliang;
3.导出数据库
exp 导出
exp test(数据库用户名)/123456(密码)@192.168.1.3(主机标识符) file=d:\0704.dmp(导出文件路径) log=d:\0704.log (屏幕日志) owner=test (所有者用户名列表)
exp test/123456@192.168.1.3 file=d:\0704.dmp log=d:\0704.log owner=test
4.导入数据库
imp 导入
imp test1/123456@192.168.1.3 file=d:\0704.dmp log=d:\0704.log fromuser=test touser=test1
fromuser=test touser=test1 从一个用户导入到另外一个用户中;
5.
//删除表空间
非空表drop
drop tablespace dtv_account including contents and Datafiles;
表关键字被外部引用
删除该用户
然后在按 非空表drop的方法
然后删除D:\oracle\ora92\oradata目录相应的数据库文件;
6.下面这种方法我已经用过n多次了,9i也可以。
软件环境:
1、Windows xp +ORACLE 9.2
2、ORACLE安装路径为:D:\ORACLE&nbs