When switching from a root user to an oracle user, a message indicating ulimit: open files: cannot modify limit: operation not permitte is displayed. Literally, opening a file is restricted. On the same server, this situation should not occur if there is only one single oracle instance and there are few data files. Multiple instances may encounter this situation. Because multiple instances are owned by oracle users, the total number of files that oracle users can operate on is the total number of files of all instances. If the limit is exceeded, an error message is returned.
1. fault description
-- Prompt appears when switching from root to Oracle
Oracle @ v2013db02u:/u02/database> Su-Oracle
Password:
-Bash: ulimit: open files: cannot modify limit: operation not permitted
-Bash: ulimit: open files: cannot modify limit: operation not permitted
A. view the limits. conf configuration file.
Oracle @ v2013db02u: ~> More/etc/security/limits. conf
#/Etc/security/limits. conf
#
# Each line describes a limit for a user in the form:
#
# <Domain> <type> <item> <value>
#
# Where:
# <Domain> can be:
#-An user name
#-A group name, with @ group syntax
#-The wildcard *, for default entry
#-The wildcard %, can be also used with % group syntax,
# For maxlogin limit
#
# <Type> can have the two values:
#-"Soft" for enforcing the Soft Limits
#-"Hard" for enforcing Hard Limits
#
# <Item> can be one of the following:
#-Core-limits the core file size (KB)
#-Data-max data size (KB)
#-Fsize-maximum filesize (KB)
#-Memlock-Max locked-in-memory address space (KB)
#-Nofile-Max number of open files
#-RSS-Max resident set size (KB)
#-Stack-Max stack size (KB)
#-CPU-Max CPU time (min)
#-Nproc-Max number of processes
#-As-address space limit
#-Maxlogins-Max number of logins for this user
#-Maxsyslogins-Max number of logins on the System
#-Priority-the priority to run user process
#-Locks-Max number of file locks the user can hold
#-Sigpending-Max number of pending Signals
#-Msgqueue-Max memory used by POSIX message queues (bytes)
#-Nice-Max nice priority allowed to raise
#-Rtprio-Max realtime priority
#
# <Domain> <type> <item> <value>
#
# * Soft Core 0
# * Hard RSS 10000
# @ Student hard nproc 20
# @ Faculty soft nproc 20
# @ Faculty hard nproc 50
# Ftp hard nproc 0
# @ Student-maxlogins 4
# End of File
-- The comments in the limits. conf file provide a good description, that is, we can configure different items in soft and hare Based on users or groups.
-- Soft is the soft limit, while hard is the hard limit. The user can exceed the soft value, but cannot exceed the hard value. Generally, soft is smaller than hard.
-- The preceding file does not provide any information for oracle users, and the wildcard * is also commented out.
-- Since this server is a new UAT server, Oracle software installs and configures infra. As we can see from the above, it should be that infra forgets or ignores the configuration value of this file.
-- When the number of database instances is small and the number of opened files is small, there is no problem. As the running instance increases, the phenomenon will emerge.
-- View the resource allocation restrictions of the current user.
-- For resource restrictions, you can also use the ulimit command to limit the user's resource allocation, such as the number of opened files, the maximum number of processes, and the CPU usage time.
-- You can use the command ulimit-a to view the current user's limit limits (ulimit usage: Man ulimit)
B. view the resource limits of the current user
Oracle @ v2013db02u: ~> Ulimit-
Core File size (blocks,-C) 0
Data seg size (Kbytes,-d) Unlimited
File size (blocks,-f) Unlimited
Pending signals (-I) 540672
Max locked memory (Kbytes,-l) 32
Max memory size (Kbytes,-m) Unlimited
Open files (-N) 1024 --> the number of opened files is limited to 1024, which is obviously not enough.
Pipe size (512 bytes,-p) 8
POSIX message queues (bytes,-q) 819200
Stack size (Kbytes,-S) 8192
CPU time (seconds,-T) Unlimited
Max user processes (-u) 16384
Virtual Memory (Kbytes,-v) Unlimited
File locks (-x) Unlimited
2. Solution
A. directly modify the limits. conf configuration file and make it permanently effective.
-- Modify the file/etc/security/limits. conf and add
V2013db02u :~ # Echo"
> Oracle soft nproc 16384
> Hard nproc 16384
> Oracle soft nofile 65536
> Oracle hard nofile 65536
> Oracle soft memlock 4000000
> Oracle hard memlock 4000000
> ">/Etc/security/limits. conf
V2013db02u :~ # Tail/etc/security/limits. conf
# End of File
Oracle soft nproc 16384
Hard nproc 16384
Oracle soft nofile 65536
Oracle hard nofile 65536
Oracle soft memlock 4000000
Oracle hard memlock 4000000
-- Author: Robinson
-- Blog: http://blog.csdn.net/robinson_0612
-- In the preceding configuration
-- Nproc: Maximum number of processes available to the user
-- Nofile: Maximum number of files that a user can open
-- Memlock: Maximum Memory Lock address space of the user
V2013db02u :~ # Su-Oracle --> switch to the Oracle user again without the previous error prompt. We recommend that you restart the server After configuring the value.
V2013db02u :~ # Su-Oracle
Oracle @ v2013db02u: ~> Ulimit-
Core File size (blocks,-C) 0
Data seg size (Kbytes,-d) Unlimited
File size (blocks,-f) Unlimited
Pending signals (-I) 540672
Max locked memory (Kbytes,-l) 4000000
Max memory size (Kbytes,-m) Unlimited
Open File (-N) 63536
Pipe size (512 bytes,-p) 8
POSIX message queues (bytes,-q) 819200
Stack size (Kbytes,-S) 8192
CPU time (seconds,-T) Unlimited
Max user processes (-u) 16384
Virtual Memory (Kbytes,-v) Unlimited
File locks (-x) Unlimited
B. Use the ulimit command to modify
-- If you use the ulimit command to modify the settings, the changes will expire after the server is restarted (temporary changes)
-- Ulimit is used to limit the resources occupied by Shell startup processes.
-- Various types of restrictions are supported: the size of the created Kernel File, the size of the process data block, the size of the file created by the Shell Process, the size of the Memory Lock, and the size of the resident memory set.
-- And the number of file descriptors opened, the maximum size of the stack allocated, the CPU time, the maximum number of threads for a single user, and the maximum virtual memory that the shell process can use
-- And restrictions on hardware and soft resources
Oracle @ v2013db02u: ~> Ulimit-N 60000 --> use the current user to modify it, that is, the Oracle user. We change it to 60000.
Oracle @ v2013db02u: ~> Ulimit-A | grep "open files" --> you can see that the resource limit has been modified.
Open File (-N) 60000
Oracle @ v2013db02u: ~> CAT/etc/security/limits. conf | grep nofile --> but the configuration value file has not changed
Oracle soft nofile 1024
Oracle hard nofile 65536
Oracle @ v2013db02u: ~> Ulimit-N 65537 --> try to modify it to a value greater than 65536 and receive the error message
-Bash: ulimit: open files: cannot modify limit: operation not permitted
Oracle @ v2013db02u: ~> Ulimit-N 65535 --> when using the ulimit command, the number value cannot be greater than the hard value in the configuration value file.
Oracle @ v2013db02u: ~> Ulimit-A | grep "open files"
Open File (-N) 65535
-- Other parameters can be processed in accordance with the above method
More references
PL/SQL --> cursor
PL/SQL --> implicit cursor (SQL % found)
Batch SQL forall statements
Bulk collect clause for batch SQL
Initialization and assignment of PL/SQL Sets
PL/SQL Union arrays and nested tables
PL/SQL variable-length Array
PL/SQL --> PL/SQL records
SQL tuning steps
Efficient SQL statements
Parent cursor, child cursor, and shared cursor
Bind variables and their advantages and disadvantages
Use of the display_cursor function of dbms_xplan
Use of the display function of dbms_xplan
Description of each field module in the execution plan
Use explain plan to obtain the SQL statement execution plan
Oracle rowid
Null Value and index (1)
Null Value and index (2)
Enable autotrace
The function invalidates the index column.
Oracle variable binding
Oracle adaptive shared cursor
Oracle tablespace and data files
Oracle Password File
Oracle parameter file
Oracle online redo log file)
Oracle Control File)
Oracle archiving logs
Oracle rollback and undo)
Oracle database instance startup and Shutdown Process
Automated Management of Oracle 10g SGA
Oracle instances and Oracle databases (Oracle Architecture)