码迷,mamicode.com
首页 > 数据库 > 详细

oracle 数据库批处理文件

时间:2017-06-07 21:42:42      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:pause   pop   proc   ble   span   min   efault   -o   fine   

文件夹结构

初始化脚本
 |----orcl_sql
	|----init_user.sql
	|----tab_home.sql
        |----TAB_USER.sql
 |----init.bat


init.bat

@echo off
@echo ---------------------------------------------------------------------
@echo ^|                                                                   ^|
@echo ^|               路边停车系统远程初始化数据库脚本工具                ^|
@echo ^|                                                                   ^|
@echo --------------------------------------------------------------------- 
@echo ^|
if exist orcl_sql/parmeter.sql (
	cd orcl_sql
	del -p parmeter.sql
	cd ..
)
set ip=127.0.0.1
set port=1521
set sid=orcl
set managerName=system
set password=admin
set newUserName=test
set newUserPWD=test
@echo ^|   ip : 127.0.0.1
@echo ^|   port : 1521
@echo ^|   sid : orcl
@echo ^|   managerName : system
@echo ^|   password : admin
@echo ^|   newUserName : test
@echo ^|   newUserPWD : test
rem set /p ip=^|   ip : 
rem set /p port=^|   port : 
rem set /p sid=^|   sid : 
rem set /p managerName=^|   managerName : 
rem set /p password=^|   password : 
rem set /p newUserName=^|   newUserName : 
rem set /p newUserPWD=^|   newUserPWD : 
@echo define userName=%newUserName%> orcl_sql/parmeter.sql
@echo define password=%newUserPWD%>> orcl_sql/parmeter.sql
@echo @orcl_sql/init_user.sql>> orcl_sql/parmeter.sql
if not exist C:\TABLESPACE (
	md C:\TABLESPACE
)
sqlplus %managerName%/%password%@%ip%:%port%/%sid% @orcl_sql/parmeter.sql
if exist orcl_sql/parmeter.sql (
	cd orcl_sql
	del -p parmeter.sql
	cd ..
)
sqlplus %newUserName%/%newUserPWD%@%ip%:%port%/%sid% @orcl_sql/tab_home.sql
@echo ^|                                                      
@echo ---------------------------------------------------------------------
@echo ^|                                                                   ^|
@echo ^|               路边停车系统远程初始化数据库脚本结束                ^|
@echo ^|                                                                   ^|
@echo --------------------------------------------------------------------- 
pause



init_user.sql


CREATE TABLESPACE TABLESPANCE_PARK 
DATAFILE 'C:\TABLESPACE\PARK.DBF' SIZE 1000M 
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;     
CREATE USER &userName IDENTIFIED BY &password DEFAULT TABLESPACE TABLESPANCE_PARK;  
GRANT CREATE TABLE,CREATE VIEW,CREATE TRIGGER, CREATE SEQUENCE,CREATE PROCEDURE TO &userName;
GRANT UNLIMITED TABLESPACE TO &userName; 
GRANT CREATE SESSION TO &userName;
grant select on v_$statname to &userName;
grant select on v_$sesstat to &userName;
grant select on v_$session to &userName;
grant select on v_$mystat to &userName;
EXIT;

</pre><strong><span style="font-size:24px"></span></strong><pre name="code" class="plain">

tab_home.sql

@orcl_sql/TAB_USER.sql
@orcl_sql/TAB_ROLE.sql
@orcl_sql/TAB_MENU.sql
.....
.....



oracle 数据库批处理文件

标签:pause   pop   proc   ble   span   min   efault   -o   fine   

原文地址:http://www.cnblogs.com/gavanwanggw/p/6959094.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!