Thinking Out Loud

October 24, 2015

Using emctl to Create Blackout

Filed under: Cloud Control — mdinh @ 7:16 pm

When it comes to using EM12c, I do not like using GUI, especially in the environment I am working with.

Aside from the rant, it’s more difficult to document steps using GUI and to reproduce or automate the steps.

If you are interested in using command line, then read on.

The blackout was created at the target (monitored) server.

Determine location of Agent installation.

[oracle@arrow ~]$ ps -ef|grep agent_inst

oracle    36878  36125  0 12:56 pts/1    00:00:00 grep agent_inst
oracle   108498      1  0 Oct17 ?        00:00:22 /u01/app/oracle/product/12.1/cc_agent/core/12.1.0.3.0/perl/bin/perl 
/u01/app/oracle/product/12.1/cc_agent/core/12.1.0.3.0/bin/emwd.pl 
agent /u01/app/oracle/product/12.1/cc_agent/agent_inst/sysman/log/emagent.nohup

[oracle@arrow ~]$ cd /u01/app/oracle/product/12.1/cc_agent/agent_inst/bin/

Create blackout.

[oracle@arrow bin]$ ./emctl start blackout WaitUntilMonday -nodeLevel -d 3:00

Oracle Enterprise Manager Cloud Control 12c Release 3  
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
Blackout WaitUntilMonday added successfully
EMD reload completed successfully

Verify blackout status.

[oracle@arrow bin]$ ./emctl status blackout

Oracle Enterprise Manager Cloud Control 12c Release 3  
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
Blackoutname = WaitUntilMonday
Targets = (arrow.local:host,)
Time = ({2015-10-23|12:57:28|180 Min,|} )
Expired = False

OOPS! Forgot to RTFM!

The blackout was created for 3 hours and not 3 days which was the intention.

The -d option is used to specify the duration of the blackout, e.g. -d 5 02:30 (5 days 2 hours and 30 minutes)

https://docs.oracle.com/cd/E24628_01/doc.121/e24473/blackouts.htm#EMADM13166

Stop blackout

[oracle@arrow bin]$ ./emctl stop blackout WaitUntilMonday

Oracle Enterprise Manager Cloud Control 12c Release 3  
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
Blackout WaitUntilMonday stopped successfully
EMD reload completed successfully

[oracle@arrow bin]$ ./emctl status blackout
Oracle Enterprise Manager Cloud Control 12c Release 3  
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
No Blackout registered.

Reference:

http://cloudcontrol12c.blogspot.com/2013/07/create-node-level-blackouts-on.html

October 9, 2015

Learning opatch

Filed under: oracle — mdinh @ 11:39 pm

For most of you, this is probably trivial.

Needed to get a list of patches for 4-nodes Exadata.

I saw co-worker ssh to each node, source ASM, database environment, run opatch command.

Thinking out loud, there’s has to be an easier way to do this; hence, I started digging into opatch commands.

It’s possible to list patches without having to source the environment.

$ORACLE_HOME/opatch lspatches -oh $ORACLE_HOME, where $ORACLE_HOME is the location for database and grid home.

List patches for all 4-nodes from node1 for ORACLE_HOME:

/u01/app/oracle/product/11.2.0.3/dbhome_1/
/u01/app/12.1.0.2/grid

[oracle@node01 ~]$ /u01/app/oracle/product/11.2.0.3/dbhome_1/OPatch/opatch lspatches -oh /u01/app/oracle/product/11.2.0.3/dbhome_1

19852361;
14201252;
18906063;QUARTERLY CRS PATCH FOR EXADATA (JUL 2015 - 11.2.0.3.28) (18906063)
21025813;QUARTERLY DATABASE PATCH FOR EXADATA (JUL 2015 - 11.2.0.3.28) : (21025813)

[oracle@node01 ~]$ /u01/app/12.1.0.2/grid/OPatch/opatch lspatches -oh /u01/app/12.1.0.2/grid

20299018;ACFS Patch Set Update : 12.1.0.2.3 (20299018)
19872484;WLM Patch Set Update: 12.1.0.2.2 (19872484)
20831113;OCW Patch Set Update : 12.1.0.2.4 (20831113)
21125181;DATABASE BUNDLE PATCH: 12.1.0.2.10 (21125181)

[oracle@node01 ~]$ ssh node02 “/u01/app/oracle/product/11.2.0.3/dbhome_1/OPatch/opatch lspatches -oh /u01/app/oracle/product/11.2.0.3/dbhome_1”

14201252;
19852361;
18906063;QUARTERLY CRS PATCH FOR EXADATA (JUL 2015 - 11.2.0.3.28) (18906063)
21025813;QUARTERLY DATABASE PATCH FOR EXADATA (JUL 2015 - 11.2.0.3.28) : (21025813)

[oracle@node01 ~]$ ssh node02 “/u01/app/12.1.0.2/grid/OPatch/opatch lspatches -oh /u01/app/12.1.0.2/grid”

20299018;ACFS Patch Set Update : 12.1.0.2.3 (20299018)
19872484;WLM Patch Set Update: 12.1.0.2.2 (19872484)
20831113;OCW Patch Set Update : 12.1.0.2.4 (20831113)
21125181;DATABASE BUNDLE PATCH: 12.1.0.2.10 (21125181)

[oracle@node01 ~]$ ssh node03 “/u01/app/oracle/product/11.2.0.3/dbhome_1/OPatch/opatch lspatches -oh /u01/app/oracle/product/11.2.0.3/dbhome_1”

14201252;
19852361;
18906063;QUARTERLY CRS PATCH FOR EXADATA (JUL 2015 - 11.2.0.3.28) (18906063)
21025813;QUARTERLY DATABASE PATCH FOR EXADATA (JUL 2015 - 11.2.0.3.28) : (21025813)

[oracle@node01 ~]$ ssh node03 “/u01/app/12.1.0.2/grid/OPatch/opatch lspatches -oh /u01/app/12.1.0.2/grid”

20299018;ACFS Patch Set Update : 12.1.0.2.3 (20299018)
19872484;WLM Patch Set Update: 12.1.0.2.2 (19872484)
20831113;OCW Patch Set Update : 12.1.0.2.4 (20831113)
21125181;DATABASE BUNDLE PATCH: 12.1.0.2.10 (21125181)

[oracle@node01 ~]$ ssh node04 “/u01/app/oracle/product/11.2.0.3/dbhome_1/OPatch/opatch lspatches -oh /u01/app/oracle/product/11.2.0.3/dbhome_1”

14201252;
19852361;
18906063;QUARTERLY CRS PATCH FOR EXADATA (JUL 2015 - 11.2.0.3.28) (18906063)
21025813;QUARTERLY DATABASE PATCH FOR EXADATA (JUL 2015 - 11.2.0.3.28) : (21025813)

[oracle@node01 ~]$ ssh node04 “/u01/app/12.1.0.2/grid/OPatch/opatch lspatches -oh /u01/app/12.1.0.2/grid”

20299018;ACFS Patch Set Update : 12.1.0.2.3 (20299018)
19872484;WLM Patch Set Update: 12.1.0.2.2 (19872484)
20831113;OCW Patch Set Update : 12.1.0.2.4 (20831113)
21125181;DATABASE BUNDLE PATCH: 12.1.0.2.10 (21125181)

I know there is also dcli utility. However, when I last tried, it did not work; hence, took the path with least resistance.

May be I will blog about dcli utility one day.

October 4, 2015

Using dynamic variables for shell scripting

Filed under: linux,oracle,shell scripting — mdinh @ 7:21 pm

So you may ask, why go through all the trouble?

Have you ever had to move scripts from one directory to another to find out the script is now broken?

This is due to the hard coding of the location for SQL script in the shell script.

When possible, I would like to separate shell / SQL scripts so they can be run individually and easier for debugging.

Don’t you hate it when copy/paste SQL from shell and require modifications?

Example:   SELECT count(*) FROM v\$transaction t, v\$session s WHERE t.addr=s.taddr

When the shell & SQL scripts have the same name, it’s more intuitive, as well as the log file.

Example:  open_trans.sh, open_trans.sql, /tmp/open_trans_hawklas.log

You can find example of shell scripts with all comments open_trans.sh

DEMO:

oracle@arrow:hawklas:/media/sf_working/scripts
$ ./open_trans.sh

Not enough variables passed to shell script.

./open_trans.sh: line 7: 1: ---> USAGE: ./open_trans.sh [oracle_sid] [minutes]

oracle@arrow:hawklas:/media/sf_working/scripts
$ ./open_trans.sh hawklas 12

The Oracle base remains unchanged with value /u01/app/oracle
+ rm -fv /tmp/open_trans_hawklas.log
removed `/tmp/open_trans_hawklas.log'
++ sqlplus -SL '/ as sysdba'
+ trans_ct='         1'
+ '[' 0 '!=' 0 ']'
+ '[' '         1' -eq 0 ']'
+ sqlplus -L '/ as sysdba'
+ '[' 0 '!=' 0 ']'
+ mail -s 'hawklas Open transactions longer than 12 minutes' dba@911.com
+ echo '*** Review /tmp/open_trans_hawklas.log for results ***'
*** Review /tmp/open_trans_hawklas.log for results ***
+ ls -l /tmp/open_trans_hawklas.log
-rw-r--r--. 1 oracle oinstall 950 Oct  4 11:48 /tmp/open_trans_hawklas.log
+ set +x

oracle@arrow:hawklas:/media/sf_working/scripts
$ cat /tmp/open_trans_hawklas.log

*** Open transactions longer than 12 minutes ***
old  17: AND t.start_date < sysdate-(&_minute/1440)
new  17: AND t.start_date < sysdate-(12/1440)

START_DT              USERNAME           OSUSER       MACHINE          PROGRAM          STATUS   EVENT                          SID_SERIAL   TSTATUS  SQLID
--------------------- ------------------ ------------ ---------------- ---------------- -------- ------------------------------ ------------ -------- -------------
04-OCT-2015 09:36:55  MDINH              oracle       arrow.localdomai sqlplus@arrow.lo INACTIVE SQL*Net message from client    108,219      ACTIVE


*** SQL syntax to kill sessions with open transactions ***
old   4: AND t.start_date < sysdate-(&_minute/1440)
new   4: AND t.start_date < sysdate-(12/1440)

SQL
-------------------------------------------------------------------------------------------------------------------------
 ALTER SYSTEM KILL SESSION '108,219' IMMEDIATE;

Run SQL script independently:

oracle@arrow:hawklas:/media/sf_working/scripts
$ sysdba @open_trans.sql 23

SQL*Plus: Release 11.2.0.4.0 Production on Sun Oct 4 11:48:34 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


NAME
----------------
hawklas


*** Open transactions longer than 23 minutes ***
old  17: AND t.start_date < sysdate-(&_minute/1440)
new  17: AND t.start_date < sysdate-(23/1440)

START_DT              USERNAME           OSUSER       MACHINE          PROGRAM          STATUS   EVENT                          SID_SERIAL   TSTATUS  SQLID
--------------------- ------------------ ------------ ---------------- ---------------- -------- ------------------------------ ------------ -------- -------------
04-OCT-2015 09:36:55  MDINH              oracle       arrow.localdomai sqlplus@arrow.lo INACTIVE SQL*Net message from client    108,219      ACTIVE


*** SQL syntax to kill sessions with open transactions ***
old   4: AND t.start_date < sysdate-(&_minute/1440)
new   4: AND t.start_date < sysdate-(23/1440)

SQL
-------------------------------------------------------------------------------------------------------------------------
 ALTER SYSTEM KILL SESSION '108,219' IMMEDIATE;


"-------------------------------------------------"
+++++ Spool Output: /tmp/open_trans_hawklas.log
"-------------------------------------------------"

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Run shell script from another directory specifying full path:

oracle@arrow:hawklas:/media/sf_working/scripts
$ cd /tmp/
oracle@arrow:hawklas:/tmp
$ /media/sf_working/scripts/open_trans.sh hawlas 45

ORACLE_HOME = [/home/oracle] ? ^C

oracle@arrow:hawklas:/tmp
$ /media/sf_working/scripts/open_trans.sh hawklas 45

The Oracle base remains unchanged with value /u01/app/oracle
+ rm -fv /tmp/open_trans_hawklas.log
removed `/tmp/open_trans_hawklas.log'
++ sqlplus -SL '/ as sysdba'
+ trans_ct='         1'
+ '[' 0 '!=' 0 ']'
+ '[' '         1' -eq 0 ']'
+ sqlplus -L '/ as sysdba'
+ '[' 0 '!=' 0 ']'
+ mail -s 'hawklas Open transactions longer than 45 minutes' dba@911.com
+ echo '*** Review /tmp/open_trans_hawklas.log for results ***'
*** Review /tmp/open_trans_hawklas.log for results ***
+ ls -l /tmp/open_trans_hawklas.log
-rw-r--r--. 1 oracle oinstall 950 Oct  4 11:49 /tmp/open_trans_hawklas.log
+ set +x

oracle@arrow:hawklas:/tmp
$ cat /tmp/open_trans_hawklas.log

*** Open transactions longer than 45 minutes ***
old 17: AND t.start_date < sysdate-(&_minute/1440)
new 17: AND t.start_date < sysdate-(45/1440)

START_DT USERNAME OSUSER MACHINE PROGRAM STATUS EVENT SID_SERIAL TSTATUS SQLID
--------------------- ------------------ ------------ ---------------- ---------------- -------- ------------------------------ ------------ -------- -------------
04-OCT-2015 09:36:55 MDINH oracle arrow.localdomai sqlplus@arrow.lo INACTIVE SQL*Net message from client 108,219 ACTIVE

*** SQL syntax to kill sessions with open transactions ***
old 4: AND t.start_date < sysdate-(&_minute/1440)
new 4: AND t.start_date < sysdate-(45/1440)

SQL
-------------------------------------------------------------------------------------------------------------------------
ALTER SYSTEM KILL SESSION '108,219' IMMEDIATE;
oracle@arrow:hawklas:/tmp
$

oracle@arrow:hawklas:/tmp
$ /media/sf_working/scripts/open_trans.sh hawklas 44444445 > /tmp/cron.log 2>&1

oracle@arrow:hawklas:/tmp
$ cat /tmp/cron.log

The Oracle base remains unchanged with value /u01/app/oracle
+ rm -fv /tmp/open_trans_hawklas.log
removed `/tmp/open_trans_hawklas.log'
++ sqlplus -SL '/ as sysdba'
+ trans_ct='         0'
+ '[' 0 '!=' 0 ']' 
+ '[' '         0' -eq 0 ']'
+ echo 'Number of opened transactions:          0'
Number of opened transactions:          0
+ exit 1
oracle@arrow:hawklas:/tmp
$ ls open*
ls: cannot access open*: No such file or directory
oracle@arrow:hawklas:/tmp
$

October 3, 2015

Using sed to format controlfile trace

Filed under: linux,oracle — mdinh @ 1:33 am

Do you find it cumbersome having to format controlfile trace?

For the most part, it’s a manual and tedious process.

Using sed, it may be possible to automate task.

RESUSE overwrites existing controlfile trace.

alter database backup controlfile to trace as ‘/tmp/cf.sql’ REUSE RESETLOGS;

ARROW:(SYS@hawklas):PRIMARY> alter database backup controlfile to trace as '/tmp/cf.sql' RESETLOGS;
alter database backup controlfile to trace as '/tmp/cf.sql' RESETLOGS
*
ERROR at line 1:
ORA-01277: file '/tmp/cf.sql' already exists


ARROW:(SYS@hawklas):PRIMARY> !ls -l /tmp/cf.sql
-rw-r--r--. 1 oracle oinstall 3917 Oct  2 17:36 /tmp/cf.sql

ARROW:(SYS@hawklas):PRIMARY> alter database backup controlfile to trace as '/tmp/cf.sql' REUSE RESETLOGS;

Database altered.

ARROW:(SYS@hawklas):PRIMARY> !ls -l /tmp/cf.sql
-rw-r--r--. 1 oracle oinstall 3915 Oct  2 17:50 /tmp/cf.sql

ARROW:(SYS@hawklas):PRIMARY> !date
Fri Oct  2 17:51:03 PDT 2015

ARROW:(SYS@hawklas):PRIMARY>

$ cat cf.sql

-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="hawklas"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- ARCHIVE_LAG_TARGET=1800
-- STANDBY_FILE_MANAGEMENT=AUTO
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE

--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "HAWK" RESETLOGS FORCE LOGGING ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 2
    MAXDATAFILES 30
    MAXINSTANCES 1
    MAXLOGHISTORY 1168
LOGFILE
  GROUP 1 '/oradata/HAWKLAS/onlinelog/o1_mf_1_bg5n7x0p_.log'  SIZE 100M BLOCKSIZE 512,
  GROUP 2 '/oradata/HAWKLAS/onlinelog/o1_mf_2_bg5n7x51_.log'  SIZE 100M BLOCKSIZE 512,
  GROUP 3 '/oradata/HAWKLAS/onlinelog/o1_mf_3_bg5n7x9m_.log'  SIZE 100M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/oradata/HAWKLAS/datafile/o1_mf_system_bg5n8n6k_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_sysaux_bg5n9c44_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_undotbs1_bg5n9scg_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_users_bg5nb91z_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_ggdata_bjysrq7q_.dbf'
CHARACTER SET AL32UTF8
;

-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
-- Configure RMAN configuration record 2
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE','DISK TO ''%d_%F''');
-- Configure RMAN configuration record 3
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('RETENTION POLICY','TO RECOVERY WINDOW OF 7 DAYS');
-- Configure RMAN configuration record 6
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('ARCHIVELOG DELETION POLICY','TO NONE');
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/oradata/fra/HAWKLAS/archivelog/2015_10_02/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE

-- Set Database Guard and/or Supplemental Logging
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/oradata/HAWKLAS/datafile/o1_mf_temp_bg5nb8df_.tmp'
     SIZE 269484032  REUSE AUTOEXTEND ON NEXT 134217728  MAXSIZE 8193M;
-- End of tempfile additions.
--

Commands for sed.

Removes all blank lines:

sed '/^ *$/d' 

Remove all comment lines:

sed '/^--/d' 

Remove all lines after line beginning with semi-colon (;):

sed '/^\;/q' 

Replace RESUSE with SET:

sed 's/REUSE/SET/g' 

Replace Exact Match ARCHIVELOG with NOARCHIVELOG:

sed 's/\<ARCHIVELOG\>/NOARCHIVELOG/g'

Example:
$ grep ARCHIVELOG cf.sql | sed ‘s/\<ARCHIVELOG\>/NOARCHIVELOG/g’

CREATE CONTROLFILE REUSE DATABASE "HAWK" RESETLOGS FORCE LOGGING NOARCHIVELOG
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('NOARCHIVELOG DELETION POLICY','TO NONE');

Note the this does not work since it is not EXACT MATCH

$ grep ARCHIVELOG cf.sql | sed 's/ARCHIVELOG/NOARCHIVELOG/g'
CREATE CONTROLFILE REUSE DATABASE "HAWK" RESETLOGS FORCE LOGGING NONOARCHIVELOG
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('NOARCHIVELOG DELETION POLICY','TO NONE');

Replace database name:

sed 's/"HAWK"/"EAGLE"/g'

Putting it all together.

sed '/^\;/q' cf.sql |sed '/^ *$/d' |sed '/--/d' |sed 's/REUSE/SET/g' |sed 's/\<ARCHIVELOG\>/NOARCHIVELOG/g' |sed 's/"HAWK"/"EAGLE"/g'
or
sed -e '/^\;/q' -e '/^ *$/d' -e '/--/d' -e 's/REUSE/SET/' -e 's/\<ARCHIVELOG\>/NOARCHIVELOG/' -e 's/"HAWK"/"EAGLE"/' cf.sql

STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "EAGLE" RESETLOGS FORCE LOGGING NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 2
    MAXDATAFILES 30
    MAXINSTANCES 1
    MAXLOGHISTORY 1168
LOGFILE
  GROUP 1 '/oradata/HAWKLAS/onlinelog/o1_mf_1_bg5n7x0p_.log'  SIZE 100M BLOCKSIZE 512,
  GROUP 2 '/oradata/HAWKLAS/onlinelog/o1_mf_2_bg5n7x51_.log'  SIZE 100M BLOCKSIZE 512,
  GROUP 3 '/oradata/HAWKLAS/onlinelog/o1_mf_3_bg5n7x9m_.log'  SIZE 100M BLOCKSIZE 512
DATAFILE
  '/oradata/HAWKLAS/datafile/o1_mf_system_bg5n8n6k_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_sysaux_bg5n9c44_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_undotbs1_bg5n9scg_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_users_bg5nb91z_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_ggdata_bjysrq7q_.dbf'
CHARACTER SET AL32UTF8
;

Updated to use sed script.

Create sed script:
$ cat cf.sed

/^\;/q
/^ *$/d
/--/d
s/REUSE/SET/
s/\<ARCHIVELOG\>/NOARCHIVELOG/
s/"HAWK"/"EAGLE"/

Run sed script interactive:
$ sed -f cf.sed cf.sql

STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "EAGLE" RESETLOGS FORCE LOGGING NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 2
    MAXDATAFILES 30
    MAXINSTANCES 1
    MAXLOGHISTORY 1168
LOGFILE
  GROUP 1 '/oradata/HAWKLAS/onlinelog/o1_mf_1_bg5n7x0p_.log'  SIZE 100M BLOCKSIZE 512,
  GROUP 2 '/oradata/HAWKLAS/onlinelog/o1_mf_2_bg5n7x51_.log'  SIZE 100M BLOCKSIZE 512,
  GROUP 3 '/oradata/HAWKLAS/onlinelog/o1_mf_3_bg5n7x9m_.log'  SIZE 100M BLOCKSIZE 512
DATAFILE
  '/oradata/HAWKLAS/datafile/o1_mf_system_bg5n8n6k_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_sysaux_bg5n9c44_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_undotbs1_bg5n9scg_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_users_bg5nb91z_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_ggdata_bjysrq7q_.dbf'
CHARACTER SET AL32UTF8
;

Run sed script output to file:
$ sed -f cf.sed < cf.sql > newcf.sql
$ cat newcf.sql

STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "EAGLE" RESETLOGS FORCE LOGGING NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 2
    MAXDATAFILES 30
    MAXINSTANCES 1
    MAXLOGHISTORY 1168
LOGFILE
  GROUP 1 '/oradata/HAWKLAS/onlinelog/o1_mf_1_bg5n7x0p_.log'  SIZE 100M BLOCKSIZE 512,
  GROUP 2 '/oradata/HAWKLAS/onlinelog/o1_mf_2_bg5n7x51_.log'  SIZE 100M BLOCKSIZE 512,
  GROUP 3 '/oradata/HAWKLAS/onlinelog/o1_mf_3_bg5n7x9m_.log'  SIZE 100M BLOCKSIZE 512
DATAFILE
  '/oradata/HAWKLAS/datafile/o1_mf_system_bg5n8n6k_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_sysaux_bg5n9c44_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_undotbs1_bg5n9scg_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_users_bg5nb91z_.dbf',
  '/oradata/HAWKLAS/datafile/o1_mf_ggdata_bjysrq7q_.dbf'
CHARACTER SET AL32UTF8
;

Blog at WordPress.com.