In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
During the National Day holiday, a customer suspended the login of the system because of the monitoring log problem. on the way back to Beijing at that time, because the customer's business was not allowed to be interrupted, he borrowed a book to help the customer do emergency treatment. I happened to be free today. I searched the contents of the monitoring log on the Internet and found a good post, which is more complete and more accurate, so that students and themselves can study and learn in the future. The post was reposted from: https://blog.csdn.net/leshami/article/details/6629043.
-- =
-- Oracle listener log configuration and Management
-- =
The Oracle listener is a server-side program that listens to all requests from the client and provides them with database services. Therefore, the management and maintenance of listeners is very important.
This article mainly describes the configuration and management of Oracle listener log. For a description of the listener, please refer to
Configure the ORACLE client to connect to the database
Configure dynamic service registration for non-default ports
I. listener log characteristics
1. Listener log is a plain text file, usually located in the $ORACLE_HOME/network/log directory and in the same path as the sqlnet.log log file
two。 Its default file name is listener.log. For non-default listeners, the resulting log file is usually listenername.log
3. The file is automatically created by the listener by default. When the log file is missing or does not exist, a file with the same name is automatically recreated, similar to the alert_.log file.
4. The size of the file will continue to grow automatically, and when the size is too large or difficult to read, consider backing it up.
5. Oracle listeners are not allowed to delete and rename log files at run time.
6. You can set the log status to ON or OFF to enable or disable logging.
Second, set up the log file directory and path
1. Two methods of setting log file directory
Lsnrctl SET LOG_DIRECTORY directory
LSNRCTL > SET LOG_DIRECTORY / usr/oracle/admin/log
two。 Two ways to set up log files
Lsnrctl SET LOG_FILE file_name
LSNRCTL > SET LOG_FILE file_name
3. Set the status of the log
Lsnrctl ET LOG_STATUS {on | off}
LSNRCTL > SET LOG_STATUS {on | off}
4. Demo Settin
a. Change to the log directory to view log files
[oracle@test ~] $cd $ORACLE_HOME/network/log
[oracle@test log] $ls-hltr
Total 348K
-rw-r--r-- 1 oracle oinstall 305K Apr 6 05:30 listener.log
-rw-r--r-- 1 oracle oinstall 26K Jun 27 01:52 listener_demo92.log
b. View the status of the current listener
[oracle@test log] $lsnrctl status listener_demo92
LSNRCTL for Linux: Version 9.2.0.8.0-Production on 27-JUN-2011 01:54:31
Copyright (c) 1991, 2006, Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=test) (PORT=1521)
STATUS of the LISTENER
-
Alias listener_demo92
Version TNSLSNR for Linux: Version 9.2.0.8.0-Production
Start Date 27-JUN-2011 01:52:18
Uptime 0 days 0 hr. 2 min. 13 sec
Trace Level off
Security ON
SNMP OFF
Listener Parameter File / oracle/92/network/admin/listener.ora
Listener Log File / oracle/92/network/log/listener_demo92.log
Listening Endpoints Summary...
(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=test) (PORT=1521))
(DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=EXTPROC)
Services Summary...
Service "demo92" has 1 instance (s).
Instance "demo92", status READY, has 1 handler (s) for this service...
The command completed successfully
c. Set listener directory and log files
LSNRCTL > set current_listener listener_demo92
Current Listener is listener_demo92
LSNRCTL > set password
Password:
The command completed successfully
LSNRCTL > set log_directory / home/oracle/log
Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=test) (PORT=1521)
Listener_demo92 parameter "log_directory" set to / home/oracle/log
The command completed successfully
LSNRCTL > set log_file listener_test.log
Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=test) (PORT=1521)
Listener_demo92 parameter "log_file" set to listener_test.log
The command completed successfully
LSNRCTL > set log_status on
Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=test) (PORT=1521)
Listener_demo92 parameter "log_status" set to ON
The command completed successfully
LSNRCTL > save_config
Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=test) (PORT=1521)
Saved listener_demo92 configuration parameters.
Listener Parameter File / oracle/92/network/admin/listener.ora
Old Parameter File / oracle/92/network/admin/listener.bak
The command completed successfully
LSNRCTL > exit
d. View the log files generated under the new path
[oracle@test admin] $cd / home/oracle/log
[oracle@test log] $ls-hltr
Total 16K
-rw-r--r-- 1 oracle oinstall 41 Jun 27 02:11 listener_demo92.log-- > generated after setting the directory
-rw-r--r-- 1 oracle oinstall 113 Jun 27 02:12 listener_test.log-- > New log file after setting the log file name
[oracle@test log] $ls-hltr-- > from time to time, the original log file is no longer growing. Log is recorded using the set log file name.
Total 16K
-rw-r--r-- 1 oracle oinstall 41 Jun 27 02:11 listener_demo92.log
-rw-r--r-- 1 oracle oinstall 1.3K Jun 27 02:17 listener_test.log
e. View changes in the listener.ora configuration file
[oracle@test admin] $more listener.ora
#-ADDED BY TNSLSNR 27-JUN-2011 02Rose 12RV 37muri-
LOG_DIRECTORY_listener_demo92 = / home/oracle/log
LOG_FILE_listener_demo92 = listener_test.log
LOGGING_listener_demo92 = ON
#-
III. Backup and renaming of log files
In general, you need to stop the listener to back up the log files. Here is to rename the log files without stopping listening.
1. Processing of Windows platform
C:\ > cd\ oracle\ ora92\ network\ log-- > change to the directory where listener log is located
C:\ oracle\ ora92\ network\ log > lsnrctl set log_status off-- > pause or offline log files
C:\ oracle\ ora92\ network\ log > rename listener.log listener.old-- > rename the log file, usually with a date
C:\ oracle\ ora92\ network\ log > lsnrctl set log_status on-- > online listener log will automatically recreate a new log file
2. Processing of Unix/Linux platform
$lsnrctl set log_status off
$mv listener.log listener.old-- > another method, cp listener.log / log/bak/. Then cp / dev/null > listener.log
$lsnrctl set log_status on
3. Demonstrate renaming log files on the Linux platform
[oracle@test ~] $cd / home/oracle/log
[oracle@test log] $lsnrctl set log_status off-- > if a password exists, it should be done using the LSNRCTL interface
LSNRCTL for Linux: Version 9.2.0.8.0-Production on 27-JUN-2011 02:41:09
Copyright (c) 1991, 2006, Oracle Corporation. All rights reserved.
Connecting to (ADDRESS= (PROTOCOL=tcp) (PORT=1521))
LISTENER parameter "log_status" set to OFF
The command completed successfully
[oracle@test log] $mv listener_test.log listener_test.old
[oracle@test log] $lsnrctl set log_status on
LSNRCTL for Linux: Version 9.2.0.8.0-Production on 27-JUN-2011 02:41:31
Copyright (c) 1991, 2006, Oracle Corporation. All rights reserved.
Connecting to (ADDRESS= (PROTOCOL=tcp) (PORT=1521))
LISTENER parameter "log_status" set to ON
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.