0% found this document useful (0 votes)
78 views5 pages

Check Control File Location:: Task1

The document discusses various tasks related to managing Oracle database files including: 1. Checking and recreating the control file if deleted. 2. Creating new control files and deleting existing control files. 3. Adding and deleting redo log files and redo log groups. 4. Creating, resizing, renaming, and dropping tablespaces and datafiles.

Uploaded by

Kancharla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views5 pages

Check Control File Location:: Task1

The document discusses various tasks related to managing Oracle database files including: 1. Checking and recreating the control file if deleted. 2. Creating new control files and deleting existing control files. 3. Adding and deleting redo log files and redo log groups. 4. Creating, resizing, renaming, and dropping tablespaces and datafiles.

Uploaded by

Kancharla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

Task1>

check control file location:

SQL> select name from v$controlfile;


(or)
SQL>show parameter control_file; -------To check control file location

If controlfile deleted:

[swapna@of20 swapnadb]$ pwd

/d01/swapna/oradata/swapnadb

[swapna@of20 swapnadb]$ mv control01.ctl control01.ctl_bkp

SQL> shutdown immediate

SQL> startup

ORACLE instance started.


Total System Global Area 730714112 bytes

Fixed Size 2147992 bytes

Variable Size 532679016 bytes

Database Buffers 188743680 bytes

Redo Buffers 7143424 bytes

ORA-00205: error in identifying control file, check alert log for more info

[swapna@of20 swapnadb]$ mv control01.ctl_bkp control01.ctl

SQL> shutdown immediate

ORA-01507: database not mounted

SQL> startup ------this time database will start

Task2>
create new control file:
SQL> alter system set
control_files='/d01/swapna/oradata/swapnadb/control01.ctl','/d01/swapna/oradata/swapnadb/con
trol02.ctl',

2 '/d01/swapna/oradata/swapnadb/control03.ctl',

3 '/d01/swapna/oradata/swapnadb/control04.ctl' scope=spfile;
System altered.

SQL> shutdown immediate

[swapna@of20 swapnadb]$ cp control03.ctl control04.ctl

SQL> startup

control file 04 added successfully

Task3>
delete control file:

SQL> create pfile from spfile;

File created.

[swapna@of20 swapnadb]$ cd $ORACLE_HOME/dbs

[swapna@of20 dbs]$ vi initswapnadb.ora

*.control_files='/d01/swapna/oradata/swapnadb/control01.ctl','/d01/swapna/oradata/swapnadb/control0
2.ctl','/d01/swapna/oradata/swapnadb/control03.ctl' --------delete control04 datafile
:wq!
[swapna@of20 dbs]$ cd -
/d01/swapna/oradata/swapnadb
[swapna@of20 swapnadb]$ ls

[swapna@of20 swapnadb]$ mv control04.ctl control04.ctl_bkp

SQL> shutdown immediate

SQL> create spfile from pfile;

File created.

SQL> startup

SQL> select name from v$controlfile;

control file 04 deleted successfully


Task4>
add members to redo log groups:
SQL> select member from v$logfile; ---------to check redo log files location
SQL> alter database add logfile member

2 '/d01/swapna/oradata/swapnadb/redo01a.log' to group 1,
3 '/d01/swapna/oradata/swapnadb/redo02a.log' to group 2,

4 '/d01/swapna/oradata/swapnadb/redo03a.log' to group 3;

Database altered.

add redo group to database:

SQL> alter database add logfile group


4('/d01/swapna/oradata/swapnadb/redo04.log','/d01/swapna/oradata/swapnadb/redo04a.log') size
1m;

Error:
ORA-00336: log file size 2048 blocks is less than minimum 8192 blocks

solution:
change siize to 20m
SQL>ed
1* alter database add logfile group
4('/d01/swapna/oradata/swapnadb/redo04.log','/d01/swapna/oradata/swapnadb/redo04a.log') size 20m

SQL> /
Database altered.
successfully added redo group 4 with 2 members

Task5>
delete redo log group 4:
SQL> alter system switch logfile; --------this is for switch enother log group to current state

System altered.

SQL>/
system altered.
SQL> alter database drop logfile group 4;

Database altered.

SQL> select group#,members from v$log;

[swapna@of20 swapnadb]$ rm -rf redo04a.log redo04.log

redo log group 4 dropped successfully


Task6>
create tablespace:

SQL> create tablespace ts1 datafile '/d01/swapna/oradata/swapnadb/ts1df01.dbf' size 10m;

SQL> select tablespace_name from dba_tablespaces;


(or)
SQL> select tablespace_name from dba_data_files; (or) ------“but hear temp ts will not get”
SQL> select name from v$tablespace;
----------to check tablespace names

resize the datafile:

SQL> select bytes/1024/1024 from dba_data_files;

SQL> alter database datafile '/d01/swapna/oradata/swapnadb/ts1df01.dbf' resize 5m;

Database altered.
rename the datafile that is moving from one location to another:
1> SQL> alter tablespace ts1 offline;

Tablespace altered.

2> SQL> select name,status from v$datafile;

3> [swapna@of20 swapnadb]$ mkdir mydatafiles

[swapna@of20 swapnadb]$ mv ts1df01.dbf mydatafiles/

4> SQL> alter tablespace ts1 online;

Tablespace altered.

5> SQL> select name,status from v$datafile;

datafile renamed successfully

Task7>
drop tablespace:
SQL>drop tablespace ts1 including contents and datafiles;
tablespace dropped

Task8>
SQL> select sum(bytes/1024/1024) from dba_segments;

SUM(BYTES/1024/1024)
--------------------
1237.375

SQL> select sum(bytes/1024/1024) from dba_extents;

SUM(BYTES/1024/1024)
--------------------

1237.1875

You might also like