windows下Oracle11G脚本建用户、表空间、表

@echo off
set uname=%1%
set pword=%2%
echo %uname%
echo %pword%
echo @echo off>C:\createUser.sql
echo create temporary tablespace user_temp>>C:\createUser.sql
echo tempfile 'C:\app\Administrator\oradata\user_temp.dbf'>>C:\createUser.sql
echo size 50m>>C:\createUser.sql
echo autoextend on>>C:\createUser.sql
echo next 50m maxsize 20480m>>C:\createUser.sql
echo extent management local;>>C:\createUser.sql
echo create tablespace user_data>>C:\createUser.sql
echo logging>>C:\createUser.sql
echo datafile 'C:\app\Administrator\oradata\user_data.dbf'>>C:\createUser.sql
echo size 50m>>C:\createUser.sql
echo autoextend on>>C:\createUser.sql
echo next 50m maxsize 20480m>>C:\createUser.sql
echo extent management local;>>C:\createUser.sql
echo create user %uname% identified by %pword%>>C:\createUser.sql
echo default tablespace user_data>>C:\createUser.sql
echo temporary tablespace user_temp;>>C:\createUser.sql
echo grant connect,resource,dba to %uname%;>>C:\createUser.sql
echo exit;>>C:\createUser.sql

echo @echo off>C:\createTable.sql
echo CREATE TABLE DEPT>>C:\createTable.sql
echo (DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,>>C:\createTable.sql
echo DNAME VARCHAR2(14),>>C:\createTable.sql
echo LOC VARCHAR2(13));>>C:\createTable.sql
echo INSERT INTO DEPT VALUES(1,'IT','XIAN');>>C:\createTable.sql
echo INSERT INTO DEPT VALUES(2,'core','XIAN');>>C:\createTable.sql
echo INSERT INTO DEPT VALUES(3,'wireless','XIAN');>>C:\createTable.sql
echo COMMIT;>>C:\createTable.sql
echo exit;>>C:\createTable.sql

sqlplus / as sysdba @C:\createUser.sql 

sqlplus %uname%/%pword%@orcl @C:\createTable.sql
exit 0

新闻名称:windows下Oracle11G脚本建用户、表空间、表
文章转载:http://pwwzsj.com/article/joggpp.html