Saturday, 14 January 2017

Rotating stdout Log Files with UNIX OS Commands in Weblogic

SOLUTION

You can use the logrotate command along with the copytruncate option to rotate the log files in your environment. This option can also be combined with any other option pertaining to size-based or time-based rotation. For example, logrotate.conf:

/opt/weblogic/user_projects/domains/my_domain/servers/Server1/logs/er.out (or *.out) {
rotate 7 # rotates keeps logs for 7 weeks then overwrites.
size 200M # rotates log after the size reaches 200m
copytruncate # Copy logfile, then truncate it in place
missingok # tells logrotate not to issue an error if the log file is missing
notifempty # tells logrotate not to rotate a log if it's already empty

create 644 weblogic users # After rotation, re-create logfile with the specified permissions, owner, and group

endscript
}
The above script is simply an example of what parameters we can enter.

After creating the above script the following command can be used for log rotation.

logrotate -f logrotate.conf
Here -f is used for forced log rotation. For daily rotation we can setup something like a cron job. Following is an example of the same.

more /etc/cron.daily/logrotate

Default :


[root@mac2 bin]#  more /etc/cron.daily/logrotate
#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
   /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
You can consider something like the following for using a custom logrotate.conf:

$ cat /etc/cron.daily/logrotate
#!/bin/sh

/usr/sbin/logrotate /home/anjhawar/Oracle/Middleware/user_projects/domains/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
   /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0

PGA memory used by the instance exceeds PGA_AGGREGATE_LIMIT of 30720 MB

Oracle Database - Enterprise Edition - Version 12.1.0.1 and later
Information in this document applies to any platform.


If the value of PGA_AGGREGATE_LIMIT is reached, an error will be reported.

ORA-04036: PGA memory used by the instance exceeds PGA_AGGREGATE_LIMIT
Cause: Private memory across the instance exceeded the limit specified in the PGA_AGGREGATE_LIMIT initialization parameter. The largest sessions using Program Global Area (PGA) memory were interrupted to get under the limit.
Action: Increase the PGA_AGGREGATE_LIMIT initialization parameter or reduce memory usage.




ORA-00756 detected lost write of a data block

Found below error message in alert log while switch over in DR site.

ORA-00756: recovery detected a lost write of a data block
ORA-10567: Redo is inconsistent with data block (file# 60, block# 871712, file offset is 2846097408 bytes)
ORA-10564: tablespace APPS_UNDOTS1
ORA-01110: data file 60: '/d4/oraprod/PROD/apps_st/data/undo_ts1b.dbf'
ORA-10560: block type 'KTU UNDO BLOCK'

Lost writes are caused by factors external to Oracle RDBMS. This normally happens when the operating system does not raised any errors while trying to write a blcok on disk, but still the write didn't get into the persistent storage.
So since there is no error, for Oracle, this is a complete write because the system call didn't produce any errors.
And then later, when reading the block, Oracle may realize by comparing the block with a different block that the block is not current.

As the affected datafile is part of UNDO tablespace you should replace the datafiles on STANDBY using the steps from Note 453153.1 - Recovering the primary database's datafile using the physical standby, and vice versa

Solution:

Please set below parameter on both primary and standby database . Please refer document 1265884.1 & 1302539.1 for more details and parameter impact on the database . 
DB_LOST_WRITE_PROTECT =TYPICAL 
DB_BLOCK_CHECKING=FULL 

ORA-07445: [slmecpy()+56] and ORA-600 [kghubigallasp_02]]

Facing above error in 12.1.0.2 Database.

ORA-00600: internal error code, arguments: [kghubigallasp_02], [0xFFFFFFFF58C48080], [0], [0], [0], [], [], [], [], [], [], [] 
ORA-07445: exception encountered: core dump [slmecpy()+56] [SIGSEGV] [ADDR:0x0] [PC:0x10B676DEC] [Address not mapped to object] [] 




Oracle raised bug request with development team for resolution.
 Bug 16729624 

Adgendbc.sh Fails With Invalid Arguments

While running autoconfig ,it is failing with following error


Generating <$FND_TOP>/secure/<Hostname>_<SID>.dbc
java.sql.SQLException: Io exception: Connection
refused(DESCRIPTION=(ERR=1153)(VSNNUM=153093632)(ERROR_STACK=(ERROR=(CODE=1153)(EMFI=4)(ARGS='(DESCR
IPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=<Hostname>)(PORT=<Port Number>)))(CONNECT_DATA=(CID=
(PROGRAM=)(HOST=__jdbc__)(USER=))SERVICE_NAME, <SID>))'))(ERROR=(CODE=303)(EMFI=1))))
Database connection to
jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=YES)(FAILOVER=YES)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)
(HOST=<Hostname>)(PORT=<Port Number>)))(CONNECT_DATA=(SERVICE_NAME=<Hostname>, <SID>))) failed
DBC generation failed with exit code 1
Updating parameters: fnd_jdbc_stmt_cache_free_mem=TRUE fnd_jdbc_buffer_min=1 fnd_jdbc_buffer_max=5
Invalid arguments - 'PROD)))' not recognized

Updating parameters: fnd_jdbc_buffer_decay_interval=300 fnd_jdbc_buffer_decay_size=5
fnd_jdbc_usable_check=false
Invalid arguments - 'PROD)))' not recognized

Updating parameters: fnd_jdbc_context_check=true fnd_jdbc_plsql_reset=false
Invalid arguments - 'PROD)))' not recognized

DBC generation failed with exit code 1

Updating Server Security Authentication
java.sql.SQLException: Io exception: Invalid number format for port number
Database connection to jdbc:oracle:thin:@host_name:port_number:database failed
Updating Server Security Authentication failed with exit code 1
adgendbc.sh exiting with status 1
ERRORCODE = 1 ERRORCODE_END

Solution
1) Take a backup of the FND_DATABASE_SERVICES table.

2)  Delete entry of the "<Name of the Service>" in table FND_DATABASE_SERVICES.

3)  Run Autoconfig and re-test.