Database Creation:
To Start/Open a database we need some of the mandatory files they are
- SPfile/Pfile (Nomount stage)
- Control files (Mount stage) and
- Datafiles (read_write)
So, to create a database we need to create a SPfile/Pfile as SPfile is binary file we cannot create it so create a Pfile with the name init<database_name>.ora
For reference refer the Pfile below(for container database):
Once after creating pfile make sure the paths present in pfile are present in the server.
~> log into sqlplus command line like sqlplus / as sysdba
~> which says connected to idle instance, with the pfile which we have created open database in nomount stage with the below command
or
SQL> startup nomount pfile="$ORACLE_HOME/dbs/init<dbname>.ora"
Once after the database started in nomount stage we can execute create database command as below
USER SYSTEM IDENTIFIED BY <password>
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/container/database_name/redo1.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/container/database_name/redo2.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/container/database_name/redo3.log' SIZE 50M
DATAFILE
'/u01/app/oracle/oradata/container/database_name/system.dbf' SIZE 500m,
'/u01/app/oracle/oradata/container/database_name/user01.dbf' SIZE 500m
SYSAUX DATAFILE '/u01/app/oracle/oradata/container/database_name/sysaux.dbf' SIZE 500m
UNDO TABLESPACE UNDOTBS1
DATAFILE '/u01/app/oracle/oradata/container/database_name/undotbs1.dbf' SIZE 1000m
ENABLE PLUGGABLE DATABASE
SEED
FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/container/database_name','/u01/app/oracle/oradata/container/database_name/pdbseed/')
CHARACTER SET WE8MSWIN1252
Once after the execution of the above lines successfully,
Execute the below three plsql blocks one after the another
SQL> @?/rdbms/admin/catproc.sql
SQL> @?/sqlplus/admin/pupbld.sql
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drop Database:
~> Now, set the environment like ORACLE_SID, ORACLE_HOME, ORACLE_BASE for the database you are going to drop.
~>Connect to RMAN as target database
RMAN> CONNECT TARGET SYS@dbname
target database Password: password
connected to target database: database_name (DBID=39525561)
RMAN> STARTUP FORCE MOUNT
RMAN> SQL 'ALTER SYSTEM ENABLE RESTRICTED SESSION';
RMAN> DROP DATABASE INCLUDING BACKUPS NOPROMPT;
Comments
Post a Comment