淘先锋技术网

首页 1 2 3 4 5 6 7

创建表空间

1、首先用下面的语句查询是否有要创建的表空间"HOSPDW_TAB"和"HOSPDW_IDX",如果没有,则把D:\database\zyhip改为对应的路径,有的话直接创建用户

select tablespace_name,
       file_name,
       round(bytes / (1024 * 1024), 0) "SIZE(MB)",
       AUTOEXTENSIBLE,
       increment_by,
       round(maxbytes / (1024 * 1024), 0) max_size
  from dba_data_files
 order by tablespace_name;

2、定义块的大小

alter system set db_16K_cache_size=20m;

创建语句:

CREATE TABLESPACE "HOSPDW_TAB" --创建表空间
 blocksize 16k
 DATAFILE 'D:\oracle_database\HOSPDW_TAB01.ora' SIZE 100M  --存储路径
 AUTOEXTEND ON NEXT 50M MAXSIZE 32000M,  --表空间自动增长
 'D:\oracle_database\HOSPDW_TAB02.ora' SIZE 100M
 AUTOEXTEND ON NEXT 50M MAXSIZE 32000M
 EXTENT MANAGEMENT LOCAL 
 SEGMENT SPACE MANAGEMENT AUTO ; 
    --当设置为AUTO  时,对表而言,INITRANS和MAXTRNAS不在设置,由Oracle自己管理
 
 
CREATE TABLESPACE "HOSPDW_IDX"  --创建索引表空间
 blocksize 16k
 DATAFILE 'D:\oracle_database\HOSPDW_IDX01.ora' SIZE 50M --存储路径
 AUTOEXTEND ON NEXT 50M MAXSIZE 32000M, --表空间自动增长
 'D:\oracle_database\HOSPDW_IDX02.ora' SIZE 50M
 AUTOEXTEND ON NEXT 50M MAXSIZE 32000M
 EXTENT MANAGEMENT LOCAL 
 SEGMENT SPACE MANAGEMENT AUTO ;

3、创建用户

-- CREATE THE USER

CREATE USER XXXXXX  --创建用户

IDENTIFIED BY XXX  --用户密码

  DEFAULT TABLESPACE HOSPDW_TAB

  TEMPORARY TABLESPACE TEMP

  PROFILE DEFAULT;


-- GRANT/REVOKE ROLE PRIVILEGES

GRANT CONNECT TO XXXXXX WITH ADMIN OPTION;

GRANT DBA TO XXXXXX WITH ADMIN OPTION;

GRANT RESOURCE TO XXXXXX WITH ADMIN OPTION;

-- GRANT/REVOKE SYSTEM PRIVILEGES

GRANT CREATE PROCEDURE TO XXXXXX;

GRANT CREATE PUBLIC SYNONYM TO XXXXXX;

GRANT CREATE TABLE TO XXXXXX;

GRANT CREATE VIEW TO XXXXXX;

GRANT DEBUG ANY PROCEDURE TO XXXXXX;

GRANT DELETE ANY TABLE TO XXXXXX;

GRANT DROP PUBLIC SYNONYM TO XXXXXX;

GRANT INSERT ANY TABLE TO XXXXXX;

GRANT SELECT ANY DICTIONARY TO XXXXXX;

GRANT SELECT ANY SEQUENCE TO XXXXXX;

GRANT SELECT ANY TABLE TO XXXXXX WITH ADMIN OPTION;

GRANT UNLIMITED TABLESPACE TO XXXXXX WITH ADMIN OPTION;

GRANT UPDATE ANY TABLE TO XXXXXX;

 

imp导入文件脚本cmd输入

imp 用户名/密码@实例名 file=E:\HISDSS\hismd_20121123_user.dmp log=E:\HISDSS\hismd_20121123_user.log full=y ignore=y

 

流程总结:

1.查看表空间是否已经有了。有了的话就新建用户,用户命名规则为LZGRHOSP。没有的话就建表空间然后建用户。

2.有了表空间和用户,就把我们发给你的dmp文件导入所建立用户中就可以了。