PL/SQL Client connects Oracle quickly to resolve disconnection issues

Source: Internet
Author: User
Tags database issues sql client sessions set time

PL/SQL login for a short time session automatically disconnects

1. First look at your profile file for this user

Select profile from dba_users where username= ' username ';

2. Review the Idle_time settings in the profile file

SELECT * from Dba_profiles where profile= ' profilename ';

3. If the Idle_time value found in the second step is small, modify it to unlimited without limiting

Alter profile Prfilename idle_time=unlimited;

4. If you have changed, automatically disconnect check the settings of the PL/SQL tool

Tools->preferences->connection: Tick Check Connection

http://blog.csdn.net/rgb_rgb/article/details/8073030

[Python]View Plaincopyprint?
  1. Sgcrm5*sgcrm5-/home/oracle >sqlplus/as SYSDBA
  2. Sql*plus:release 11.1. 0.6.0-production on Mon Oct : £º
  3. Copyright (c) 1982, Oracle.  All rights reserved.
  4. Connected to:
  5. Oracle Database 11g Enterprise Edition Release 11.1. 0.6.0- 64bit Production
  6. With the partitioning, OLAP, Data Mining and Real application testing Options
  7. [Email protected] 129.100.253.79> Show parameter Resource_limit
  8. NAME TYPE VALUE
  9. ------------------------------------ ----------- ------------------------------
  10. Resource_limit Boolean FALSE
  11. [Email protected]  129.100.253.79> alter system set RESOURCE_LIMIT=TRUE Scope=both;
  12. System altered.
  13. Elapsed: xx:00.08
  14. [Email protected] 129.100.253.79> Select Username,profile from dba_users
  15. 2;
  16. USERNAME profile
  17. ------------------------------ ------------------------------
  18. 9959 DEFAULT
  19. SCOTT DEFAULT
  20. SPOTLIGHT DEFAULT
  21. SPATIAL_WFS_ADMIN_USR DEFAULT
  22. Mddata DEFAULT
  23. Xs$null DEFAULT
  24. Apex_public_user DEFAULT
  25. Tsmsys DEFAULT
  26. DIP DEFAULT
  27. SPATIAL_CSW_ADMIN_USR DEFAULT
  28. ORACLE_OCM DEFAULT
  29. Owbsys DEFAULT
  30. Exfsys DEFAULT
  31. flows_030000 DEFAULT
  32. Flows_files DEFAULT
  33. Wk_test DEFAULT
  34. Dbsnmp Monitoring_profile
  35. Wmsys DEFAULT
  36. Ordsys DEFAULT
  37. Wksys wksys_prof
  38. XDB DEFAULT
  39. Olapsys DEFAULT
  40. Si_informtn_schema DEFAULT
  41. Ordplugins DEFAULT
  42. Wkproxy DEFAULT
  43. Mdsys DEFAULT
  44. Sysman DEFAULT
  45. Ctxsys DEFAULT
  46. ANONYMOUS DEFAULT
  47. SYS DEFAULT
  48. SYSTEM DEFAULT
  49. Mgmt_view DEFAULT
  50. Outln DEFAULT
  51. Rows selected.
  52. Elapsed: xx:00.05
  53. [Email protected]  129.100.253.79> SELECT distinct from dba_profiles;
  54. Profile
  55. ------------------------------
  56. Wksys_prof
  57. DEFAULT
  58. Monitoring_profile
  59. PROFILE9959
  60. Elapsed: xx:00.01
  61. [Email protected] 129.100.253.79> SELECT Name, value
  62. 2 from Gv$parameter
  63. 3 WHERE name = ' Resource_limit ';
  64. NAME
  65. --------------------------------------------------------------------------------
  66. VALUE
  67. --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------
  68. Resource_limit
  69. TRUE
  70. Elapsed: xx:00.01
  71. [Email protected]  129.100.253.79> Alter user system profile PROFILE9959;
  72. User altered.
  73. Elapsed: xx:00.07
  74. [Email protected] 129.100.253.79>

Attention:

After the setting is complete, the session that is already connected does not work and the session on the new connection takes effect.

Use the alter system dynamically or use the initialization parameter Resource_limit to make resource restrictions effective. The change is not valid for the password resource and the password resource is always available.

After setting idle_time in the database profile, if the session exceeds this limit, the Pmon process will:

[SQL]View Plaincopyprint?
    1. * Mark the v$session as sniped
    2. * Clean up the database resources for the session
    3. * Remove the V$session entry

There are often sniped-state sessions, which are inactive, but occupy the number of users ' sessions:

Select Sid,serial#,paddr,username,status from v$session where status = ' sniped ';

Here we see the phenomenon is v$session, the session has not been cleaned. In the best case scenario, when the user tries to connect to the session again, they receive a ORA-02396 error, and the session is cleaned up.

Attempting to use alter system kill session,v$session marked as killed,v$process, OS process is not cleaned up.

[Python]View Plaincopyprint?
    1. Select Type,s.username,s.status,s.machine,s.program,' alter system kill session ' | | "'" | | s.sid| | ', ' | | s.serial# | | '; ' Oracle_level_kill,paddr from v$session s where status = ' killed '
    2. Select ' kill-9 ' | |  SPID Unix_level_kill from v$process where addr=' 07000002309e5be8 ';

Kill-9 on OS, session is cleaned up.

[Python]View Plaincopyprint?
  1. DROP profile PROFILE9959 CASCADE;
  2. CREATE Profile PROFILE9959 LIMIT
  3. Sessions_per_user UNLIMITED
  4. Cpu_per_session UNLIMITED
  5. Cpu_per_call UNLIMITED
  6. Connect_time UNLIMITED
  7. Idle_time
  8. Logical_reads_per_session UNLIMITED
  9. Logical_reads_per_call UNLIMITED
  10. Composite_limit UNLIMITED
  11. PRIVATE_SGA UNLIMITED
  12. Failed_login_attempts Ten
  13. Password_life_time
  14. Password_reuse_time UNLIMITED
  15. Password_reuse_max UNLIMITED
  16. Password_lock_time 1
  17. Password_grace_time 7
  18. Password_verify_function NULL;

Profile: The name of the configuration file. The Oracle Database forces resource throttling in the following ways:

1. If the user exceeds the session resource limit of Connect_time or idle_time, the database rolls back the current transaction and ends the session. The user executes the command again, and the database returns an error,

2. If the user tries to perform an operation that exceeds the other session resource limit, the database discards the operation, rolls back the current transaction, and returns an error immediately. After the user can commit or roll back the current transaction, the session must end.

Tip: You can limit the time by dividing one piece into multiple segments, such as 1 hours (1/24 days), and you can specify resource limits for the user, but the database will not enforce the limit until the parameters are valid.

Unlimited: The user assigning this profile has unrestricted access to the resource, and when the password parameter is used, Unlimited means that there is no restriction on the parameters.

Default: Specifying default means ignoring some resource restrictions on the profile, and the default profile initial definition is not limited to resources and can be changed by the Alter Profile command.

Resource_parameter part

Session_per_user: Specifies the number of concurrent sessions that limit the user.

Cpu_per_session: Specifies the CPU time limit for the session, in 1% seconds.

Cpu_per_call: Specifies the CPU time limit for one invocation (parse, execute, and fetch) in 1% seconds.

Connect_time: Specifies the total connection time, in minutes, for the session.

Idle_time: Specifies the total time, in minutes, that the session is allowed to be continuously inactive, and the session will be disconnected. However, long-running queries and other operations are not subject to this limitation.

Logical_reads_per_session: Specifies the number of blocks of data that a session allows to read, including all blocks of data read from memory and disk.

Logical_read_per_call: Specifies the maximum number of data blocks that are allowed to be read by the Execute SQL (parse, execute, and fetch) call at one time.

PRIVATE_SGA: Specifies the maximum amount of space, in bytes, that a session can allow to allocate in the shared pool (SGA). (This restriction is only valid when using the shared server structure, where the private space of the session in the SGA includes both private and PL/SQL, but not shared SQL and PL/SQL).

Composite_limit: Specifies the total resource consumption for a session, expressed in service units units. Oracle database calculates cpu_per_session,connect_time,logical_reads_per_session and PRIVATE-SGA total service units in a profitable way

Password_parameter section:

Failed_login_attempts: Specifies the maximum number of times that an attempt to log in is allowed before the account is locked out.

Password_life_time: Specifies the number of days that the same password is allowed to use. If the Password_grace_time parameter is specified at the same time, if the password is not changed within grace period, the password is invalidated and the connection database is rejected. If the Password_grace_time parameter is not set, the default value of unlimited raises a database warning, but allows the user to continue the connection.

Password_reuse_time and Password_reuse_max: These two parameters must be associated with each other, password_reuse_time specifies the number of days before the password cannot be reused, and password_reuse_ MAX Specifies the number of times the password has changed before the current password is reused. Two parameters must be set to an integer.

1. If an integer is specified for both parameters, the user cannot reuse the password until the password has been changed Password_reuse_max the specified number of times after the specified amount of time in Password_reuse_time.

For example: password_reuse_time=30,password_reuse_max=10, the user can reuse the password after 30 days, requiring the password to be changed more than 10 times.

2. If one of these is specified as an integer and the other is unlimited, the user can never reuse a password.

3. If you specify one of the default values that are defined in profile for the Default,oracle database, all parameters are set to unlimited in profiles by default, and if you do not change the profile default value, The database always defaults to unlimited for this value.

4. If all two parameters are set to unlimited, the database ignores them.

Password_lock_time: Specifies the set time, in days, for the number of failed login attempts to reach payback households.

Password_grace_time: Specifies the number of days to expire, and the database issues a warning to the number of days before the login expires. If the database password is not modified in the middle, the expiration is invalidated.

Password_verify_function: This field allows complex PL/SQL password validation scripts to be passed as parameters to the Create profile statement. The Oracle database provides a default script, but you can create your own validation rules or use third-party software validation. For a function name, specifying the name of the password validation rule, which is specified as NULL, means that the password verification feature is not used. If you specify an expression for the password parameter, the expression can be in any format except for the database-scalar subquery.

Refer to: http://psoug.org/reference/profiles.html

PL/SQL Client connects Oracle quickly to resolve disconnection issues

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.