1. 数据库oracle安装

2. 数据库用户创建,表空间创建,表创建

#!/bin/bash

current_path=`pwd`
create_tablespace=${current_path}/create_tablespace.sql
create_tables=${current_path}/create_tables.sql
install_log=${current_path}/installlog.log
sqllog=${current_path}/sql.log function create_table_space
{
if [ ! -f ${create_tablespace} ]; then
echo "${create_tablespace} is not exist "
return 1
fi
logger "info" "executing ${create_tablespace}..." sqlplus / as sysdba >${sqllog}<<EOF
@${create_tablespace}
EOF
if [ $? != 0 ]; then
logger "error" "create table space failed"
return 1
fi error_info=`grep "ERROR" ${sqllog}`
if [ "${error_info}X" != "X" ]; then
logger "error" "create table space failed"
cat ${sqllog}
return 1
fi
logger "info" "create table space success"
return 0
} function create_tables
{
if [ ! -f ${create_tables} ]; then
logger "error" "${create_tables} is not exist.."
return 1
fi
logger "info" "executing create tables..."
sqlplus rocky/rocky12345@ora11g >>${sqllog}<<EOF
@${create_tables}
EOF
if [ $? != 0 ]; then
logger "error" "create tables failed..."
return 1
fi error_info=`grep ERROR ${sqllog}`
if [ "${error_info}X" != "X" ]; then
logger "error" "create tables failed..."
return 1
fi
logger "info" "create tables success..."
return 0
} function main
{
echo "start install rocky" >${install_log}
echo `date`>>${install_log}
echo "start install rocky"
echo "[step 1] create table space"
create_table_space
if [ $? != 0 ]; then
return 1
fi echo "[step 2] create tables"
create_tables if [ $? != 0 ]; then
return 1
fi } function logger
{
if [ $# == 2 ]; then
echo "[$1]:[$2]"
echo "[$1]:[$2]" >>${install_log}
return
fi
} main $*

主安装脚本

create or replace  procedure clean_user
as
v_count integer;
begin
select count(*) into v_count from user_tablespaces where upper(tablespace_name)=upper('rocky_default');
If v_count > 0 Then
Execute immediate 'drop tablespace rocky_default including contents and datafiles cascade constraints';
end if; Execute immediate 'create tablespace rocky_default datafile ''/home/oracle/test/rocky.dbf'' size 100M autoextend on next 10M maxsize 500M';
Execute immediate 'create user rocky identified by rocky12345 default tablespace rocky_default';
Execute immediate 'GRANT CONNECT,RESOURCE,CREATE ANY TABLE,DROP ANY TABLE,CREATE SEQUENCE,DROP ANY SEQUENCE, CREATE DATABASE LINK, CREATE VIEW to rocky'; end;
/
execute clean_user;
/
exit;

create_tablespace.sql

create or replace  procedure clean_tables
as
v_count integer;
begin
select count(*) into v_count from user_tables where upper(table_name)=upper('T_MEMBER_INFO');
If v_count > 0 Then
Execute immediate 'drop table T_MEMBER_INFO';
end if;
end;
/
execute clean_tables;
/ create table T_MEMBER_INFO
(
username varchar(200) not null,
password varchar(100) not null,
groupid number(9) not null
);
alter table T_MEMBER_INFO add constraint PK_MEMBER_USERNAME primary key (username);
exit;
/

create_tables.sql

WEB工程数据库相关安装脚本写作的更多相关文章

  1. 【转载】linux-查询rpm包相关安装、卸载脚本

        测试过程中,有时要测试开发自己打的rpm包,为了确认打包正确,需要查询rpm包相关安装.卸载脚本,可以使用命令:   [root@6 /]#rpm -q --scripts mysql pos ...

  2. Nginx+Python+uwsgi+Django的web开发环境安装及配置

    Nginx+Python+uwsgi+Django的web开发环境安装及配置 nginx安装 nginx的安装这里就略过了... python安装 通常系统已经自带了,这里也略过 uwsgi安装 官网 ...

  3. Azkaban2.5安装部署(系统时区设置 + 安装和配置mysql + Azkaban Web Server 安装 + Azkaban Executor Server安装 + Azkaban web server插件安装 + Azkaban Executor Server 插件安装)(博主推荐)(五)

    Azkaban是什么?(一) Azkaban的功能特点(二) Azkaban的架构(三) Hadoop工作流引擎之Azkaban与Oozie对比(四) 不多说,直接上干货! http://www.cn ...

  4. 一个比较完整的Inno Setup 安装脚本(转)

    一个比较完整的Inno Setup 安装脚本,增加了对ini文件设置的功能,一个安装包常用的功能都具备了. [Setup] ; 注: AppId的值为单独标识该应用程序. ; 不要为其他安装程序使用相 ...

  5. Linux环境下JDK/Eclipse一键安装脚本

    -------------------------------------------------------------------- author:jiangxin Email:jiangxinn ...

  6. 一个比较完整的Inno Setup 安装脚本

    一个比较完整的Inno Setup 安装脚本,增加了对ini文件设置的功能,一个安装包常用的功能都具备了. [Setup] ; 注: AppId的值为单独标识该应用程序. ; 不要为其他安装程序使用相 ...

  7. LAMP最新源码一键安装脚本

    Linux+Apache+MySQL+PHP (脚本可以选择是否安装+Pureftpd+User manager for PureFTPd+phpMyAdmin+memcache),添加虚拟主机请执行 ...

  8. centos5.5 Apache2 Web 服务器的安装

    # vi /etc/httpd/conf/httpd.conf 把以下虚拟机的配置加在 httpd.conf  文件末尾即可 NameVirtualHost *:80               // ...

  9. fabric镜像安装脚本分析

    #!/bin/bash # # Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # e ...

随机推荐

  1. Java Web中资源的访问路径

    在web应用中,以“/”开头的是绝对路径,不以“/”开头的是相对路径.   在服务器端,通常都使用绝对路径.例如web.xml.struts.xml.servlet等的访问路径都是以“/”开始. 服务 ...

  2. Linux下使用w命令和uptime命令查看系统负载

    在Linux系统中查询系统CPU和内存的负载(使用率)时,我们通常习惯于使用top.atop或者ps,这篇文章将要给大家介绍如何使用w命令和uptime命令来查看系统的负载情况,对于uptime命令, ...

  3. unity介绍

  4. 处理ASP.NET 请求(IIS)

    原文:http://www.cnblogs.com/hkncd/archive/2012/03/23/2413917.html 英文原文:Beginner’s Guide: How IIS Proce ...

  5. js的MVC结构设计

    基于jquery的Deferred,设计出如下MVC架构. 模型model interface.js interface: function(userid){ var dtd = $.Deferred ...

  6. idea+maven

    使用IntelliJ IDEA开发SpringMVC网站(一)开发环境 http://my.oschina.net/gaussik/blog/385697 使用IntelliJ IDEA开发Sprin ...

  7. cmd运行java程序,无黑框闪烁

    程序目录中创建 “启动.bat” @echo off set mypath="%~dp0myjar.jar" echo %mypath% start javaw -jar %myp ...

  8. CI 笔记4 (easyui 手风琴)

    添加父div标签,和子div标签 <div class="easyui-accordion" data-options="fit:true,border:false ...

  9. exp/imp 有很多弊端

    弊端1. 空表 无法执行导出操作弊端2. 高版本的导出文件  无法使用 低版本的 oracle软件 导入 环境准备:create table test0707(n1 date); 认证弊端1 案例1. ...

  10. OpenSSL安装及目录介绍

    1. 下载安装OpenSSL 2. 根据需要下载安装Visual C++ Redistributable 3. 安装完成OpenSSL后,目录结构如下所示 其中,bin文件夹下是OpenSSL主程序的 ...