Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can log files be set to roll daily?

Status
Not open for further replies.

AntiEarnie

Technical User
May 2, 2002
215
US
I am trying to consolidate our log files to daily folder on a network drive. My problem is that I have been unable to get our Oracle 8.1.7 databases to do daily log files like our Microsoft apps where the date is just appended to the log file. I would just use a script to move the darn things but I get sharing violations every time. Is there a way to do this short of shutting down the databases?
 
Whoa...Earnie...To get that error, you must be trying to move the your on-line redo log files. That is a definite NO-NO...It will crash your database. You NEVER want to move on-line redo log files from a running Oracle database. (And that's why you are [and should be] receiving that error.)

If you want to be moving log files, you should be moving your ArchiveRedoLog Files...and they are numbered sequentially, and you can move them the moment that the archiver process is done copying the current on-line redo log file to the archive redo log file. And the deal breaker is that to even have archive redo log files, your database must be in ARCHIVELOG mode. If it isn't (and if you don't need ARCHIVELOG mode), then you don't even need to be worrying about moving the redo log files.

Let us know your thoughts.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[ Providing low-cost remote Database Admin services]
Click here to join Utah Oracle Users Group on Tek-Tips if you use Oracle in Utah USA.
 
Sorry I was not specific, I am just trying do the alert and listiner log. Not sure why they always give the sharing violation but our three main databases (on three differennt servers) all throw this error when you try to move or rename these logs unless I take the database offline.
 
three main databases (on three differennt servers) all throw this error

Well they shouldn't. I suggest you fix this first.

Do you have any other scripts / programs that are looking at these files ?

Alex
 
alexhu- There are no scripts or programs running against these logs. As far as I have ever been able to determine nothing but Oracle is using them. After all, by shutting down the instance I can do a move/rename on these files. If it was other applications it seems like I would still have the same problem when the database's are offline.
 
What is the storage media you are using? Is it a SAN or Network Attach? Are you attempting to do this at a time when a backup is being performed, the backup software may have an exclusive lock on them while it backs them up.
Can you copy them, then delete at a time when the database is scheduled to go down?
 
dbtoo2001 - No media in particular. At this point I would just be happy to move it to another folder in order to clear them. Basically, if the database is online I can do nothing with these log files besides copy them. Just doing a copy is of little use as these files grow to rather large size for text files.
 

From the above messages, I assume we're talking Windows throughout.

Alert log
=========

I take it we're talking about the system alert
log in the bdump directory.

I've never come across this file being kept locked, but then I've never come across it growing fast enough to be a nuisance. Is Oracle writing to it continuously ? - most messages should just be log switch notifications - how fast is your alert log growing, how often are you switching logs ?

Listener.log
============
I take it we're talking about the TNS listener log file
log in the \network\logs directory.

Yes, this file will be locked by the listener service, but there are a couple of easy ways to start a new one.

a) since the listener is only used for establishing new connections, you can probably stop it for a few seconds without anyone noticing - rename/move the log file and restart the listener - a 3 line DOS script which you could schedule during a quiet spell.

b) schedule a "lsnrctl set log_file" command to change the listener log file name each day. This takes immediate effect and should let you move the old one elsewhere.

Hope this helps

Steve


 
Earnie,
have you tried to copy the files and then empty the file?
A *nix shellscript could look like this:
Code:
BDUMP=/path/to/bdump
ALERT_LOG=alertSID.log
DEST=/path/to/destination
cp $BDUMP/$ALERT_LOG $DEST/$ALERT_LOG.`date +%y%m%d`
cat /dev/null >$BDUMP/$ALERT_LOG

Stefan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top