Initialize the bash shell script for Oracle users and tablespaces

Source: Internet
Author: User

The Linux script has not been written for a long time. Suddenly there is a need to write a bash shell script to initialize Oracle users and tablespaces.

Make a record for future Query

Call method:./user. sh oracle/u01/app/oracle/data_01.dbf/u01/app/oracle/index_01.dbf

The content is as follows:

#! /Bin/bash
#./User. sh oracle/u01/app/oracle/data_01.dbf/u01/app/oracle/index_01.dbf
Sqlplus-s system/$1 <EOF
Create tablespace data_01
LOGGING
DATAFILE '$ 2' SIZE 5 M
Autoextend on next 20000 k maxsize 20000 M EXTENT MANAGEMENT LOCAL
Segment space management auto;

Create tablespace index_01
LOGGING
DATAFILE '$ 3' SIZE 5 M
Autoextend on next 20000 k maxsize 20000 M EXTENT MANAGEMENT LOCAL
Segment space management auto;

Create user db_hyjzw PROFILE "DEFAULT"
Identified by db_hyjzw default tablespace data_01
QUOTA UNLIMITED
ON data_01
Account unlock;
GRANT "CONNECT" TO db_hyjzw;
GRANT "DBA" TO db_hyjzw;
Alter user db_hyjzw quota unlimited ON index_01;
Exit
EOF

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.