Shell Script to Add Date to Filenames

Below Shell Script will append Date to all FileNames in Directory with extension .TXT. Also it will create a folder with the Date and move the files to it.

FILE=”$(date +%Y%m%d)”
cd /bi_dataload
mkdir -p /bi_dataload/BI_$FILE
for f in *.TXT
mv -n “$f” /bi_dataload/BI_$FILE/”${f%%.*}”_”$FILE”.TXT

ksvcreate: Process(m000) creation failed. Error in Alert log due to DNS ip change.

Today on one of our 10g (, don’t ask !) production databases  running on AIX 5.3 we saw the following message in the alert log.

ksvcreate: Process(m000) creation failed

The database slowed down to a crawl. We couldn't login even SQLPLUS, even sqlplus -prelim couldn't bring up the instance. On starting the instance we got the below error.

ORA-00445: background process "PMON" did not start after 120 seconds

After googling around, we figured out it could be related to a DNS change. Our old DNS was commissioned and the new ones were not added to the resolv.conf file. After adding the new name servers. The instance started immediately without any issues. I'm still wondering what is the relation between the Oracle instance startup and the DNS ip's. Could this be a bug specific to or is it something more generic.

Change SYSMAN Password in Cloud Control 12c

Change OEM SYSMAN password

Incase you have forgotten the sysman password

1. Login to Cloud Control 12c database

SQL> alter user sysman identified by abc123;

2. Stop OMS

$OMS_HOME/bin/emctl stop oms

( DO not use -all postfix)

3. Change password in Repository

$OMS_HOME/bin/emctl config oms -change_repos_pwd -use_sys_pwd -sys_pwd sys123
-new_pwd abc123

changing passwords in backend …
Passwords changed in backend successfully.
Updating repository password in Credential Store…
Successfully updated Repository password in Credential Store.
Restart all the OMSs using ’emctl stop oms -all’ and ’emctl start oms’.
Successfully changed repository password.

4. Stop and Start OMS completely

$OMS_HOME/bin/emctl stop oms -all

$OMS_HOME/bin/emctl start oms

Change NLS_DATE_FORMAT via logon triggers

NLS_DATE_FORMAT is a parameter heavily dependent on a session. A good practice is to write a logon trigger depending on the application requirement to set this parameter write at the session logon. It can be done via a small script for a logon trigger.

[sourcecode language=”sql”]

execute immediate ‘alter session set nls_date_format = ”DD/MM/YYYY HH24:MI:SS” ‘;
end ;