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. 【设计模式 - 18】之备忘录模式(Memento)

    1      模式简介 备忘录模式的定义: 备忘录模式保存一个对象的某个状态,以便在适当的时候恢复对象,用作"后悔药",即取消上次操作或返回到以前的某个版本. 备忘录模式的应用实例 ...

  2. DataFromFile

    #region Copyright 2013, Andreas Hoffmann // project location ==> http://datafromfile.codeplex.com ...

  3. hdu1043Eight (经典的八数码)(康托展开+BFS)

    建议先学会用康托展开:http://blog.csdn.net/u010372095/article/details/9904497 Problem Description The 15-puzzle ...

  4. delphi TFontDialog

      设置前先获得Memo的字体属性并设置给FontDialog 然后再设置MEMO的字体属性   //设置Memo的字体属性 procedure TForm1.mni_FontClick(Sender ...

  5. cubietruck+ vncserver+source+wlan0 分类: cubieboard 2014-11-08 17:25 159人阅读 评论(0) 收藏

    正常ubuntu下直接搜索remote desktop 进行配置,好用而且友好.. modprobe bcmdhd lsmod ifconfig wlan0 up vi /etc/network/in ...

  6. cflow察看工程函数调用关系+Linux 0.11 内核实验环境

    http://savannah.gnu.org/projects/cflow http://tinylab.org/linux-0.11-lab/ http://ftp.gnu.org/gnu/cfl ...

  7. 源码解析之–网络层YTKNetwork

    首先 关于网络层最先可能想到的是AFNetworking,或者Swift中的Alamofire,直接使用起来也特别的简单,但是稍复杂的项目如果直接使用就显得不够用了,首先第三方耦合不说,就光散落在各处 ...

  8. 使用JExcel导出excel文件

    package org.aaa.portal.tools; import java.io.File; import java.io.IOException; import java.util.List ...

  9. 关于echarts绘图,主题的更换

    echarts主题进行更换步骤: 模块化单文件引入(推荐) 1.查看自己想要的主题  echarts官网 http://echarts.baidu.com/echarts2/doc/example/t ...

  10. 关于mvc 分页的 这两个结合着用

    http://www.cnblogs.com/JackFeng/archive/2010/01/25/JackFeng.html http://www.webdiyer.com/mvcpager/de ...