How to change the password of an Oracle user

Source: Internet
Author: User
Tags password book

How can I change the password of an Oracle user? This is a problem that many people have mentioned. Here we will teach you an Oracle user password method, hoping to help you.

As a Unix System Administrator, Oracle database administrator, and Oracle ERP application system administrator, you need to change the passwords of important users in different systems from time to ensure the security of the system and data.

However, due to the large number of managed minicomputers, databases, and application systems, it takes a lot of work to change the passwords of nearly users every month, regardless of the generation or change of passwords, especially for the generation of passwords, to enhance security, the password cannot be too simple. It is best to use a random combination of letters and numbers. However, if a large number of passwords are not automatically generated, the orchestration is for users in the Application System of Oracle ERP system to refer to users in various subsystems, not specific application users) it is also an Oracle database user, such as the receivables module. The user is AR, and AR is both a database user and an application user), and only a public user logging on to the system using applsyspub) and an application basic user ), apps (Specific Application Operation users) must be the same as the database password in the application system. The Oracle user password of other applications may be different from the password in the application system, you only need to change the patch to the same for the application system. Therefore, you can change the user password of the application system to be consistent with that of the database in the application system before patching. You do not need to change the password at ordinary times, which reduces the workload, second, the security of the system is enhanced.

You can change the password of a database user by executing the alter user identified by PASSWORD command in sqlplus. Therefore, you can efficiently change the password by generating a password script automatically. For Unix, the Administrator is not responsible for changing the password, so you can manually modify the password after it is automatically generated.
In order to generate a complicated password and improve work efficiency, I wrote a small script using the VBA that comes with Excel to run the program. Then, a script for changing the user password is automatically generated, record the user password on the worksheet for printing, saving it in the password book as a record. First, enter the username of each database user who wants to change the password in the first column of the worksheet. Then, enter the username in the third column and run the script gen_pass_oracle to automatically generate the corresponding password of the Oracle user; run the script gen_pass_unix to automatically generate the password of the unix operating system user. The generated Oracle user password is saved in change_pass. SQL. You can call this script in sqlplus to save the generated Unix User Password in change_pass.txt. You must manually change the password one by one.

You can modify the pass_length value in the program header to determine the length of the generated password. You can modify the start_asc method in the program header to determine the composition of the password 0-9, the A-Z or only A-Z is primarily implemented to determine whether to end password generation by checking whether a row of 1st or 3rd columns in the worksheet is empty. If it is not empty, there is a user name, then a loop is made to generate a password string of the specified length defined in the program header. The character in the password string is the new ascii value generated by the ascii value of the starting character plus the random number. Then, it is converted to the character type and added to the password string. When the length of the password string reaches the specified length, it is combined into an SQL statement and written into the file. At the same time, the password string is written to the 2nd or 4th columns of the row. Considering that strings starting with "=" are treated as formulas in Excel, ascii values equal to "=" are filtered when a password string is generated. In a similar way, the generated password string does not contain any other characters that you do not want to include.

By using this method, the workload for generating and changing passwords is greatly reduced, and the security is improved.
In fact, the password generated by this method is not limited to unix and Oracle and can be used for important users in various operating systems.

 
 
  1. Sub gen_pass_app ()
  2. Dim bit_count as integer 'cycle variable, password median counter
  3. Dim row_num as integer 'the row number starting with the username information for which the password is to be generated
  4. Dim rnd_base As Integer 'random number Seed
  5. Ascii value of each character in the Dim char_value As Integer 'Password
  6. Dim temp_str As String 'password String
  7. Dim username (50) As String 'User Name
  8. Dim pass_length as integer 'defines the length of the generated Password
  9. Dim start_asc as integer 'defines which character is generated from
  10. Pass_length = 8' set the password length to 8 characters
  11. Rem start_asc = 48 'set the password to start from 0
  12. Start_asc = 65 'set the password to start from
  13. Rem because the Oracle Database User Password is case-insensitive, the random number is determined based on the selected Start letter
  14. Rnd_base = 90-start_asc
  15. ?
  16. Rem opens the file to output the generated Password Change script
  17. Open "c: change_pass. SQL" For Output As #1
  18. At the same time, rem Records the corresponding password on the worksheet to print out the password as a record. The title is written here.
  19. Cells (1, 1) = "Username": Cells (1, 2) = "Password"
  20. Cells (1, 3) = "Username": Cells (1, 4) = "Password"
  21. Mr rem becomes the password for apps, but the script adds a comment, because the apps password must be changed with the application.
  22. Rem first initializes the password string as blank
  23. Temp_str = ""
  24. For bit_count = 1 To pass_length
  25. Char_value = start_asc + Int (Rnd (1) * rnd_base)
  26. Rem here is a program error that is caused by the incorrect expression in excel.
  27. If char_value = 61 Then
  28. Char_value = 62
  29. End If
  30. Combination of rem and password
  31. Temp_strtemp_str = temp_str + Chr $ (char_value)
  32. Next bit_count
  33. Rem outputs the generated apps password to the script file
  34. Print #1, "REM alter user apps" + "identified by" + temp_str + ";"
  35. Rem is also recorded on the worksheet
  36. Cells (2, 3) = "APPS": Cells (2, 4) = temp_str
  37. The user name for which the rem password is to be generated starts from the row row_num.
  38. Row_num = 2
  39. Rem if the first column is not empty, create a password. Otherwise, exit Do While Cells (row_num, 1) <> ""
  40. Temp_str = ""
  41. For bit_count = 1 To pass_length
  42. Char_value = start_asc + Int (Rnd (1) * rnd_base)
  43. If char_value = 61 Then
  44. Char_value = 62
  45. End If
  46. Temp_strtemp_str = temp_str + Chr $ (char_value)
  47. Next bit_count
  48. Print #1, "alter user" + Cells (row_num, 1) + "identified by" + temp_str +
  49. Cells (row_num, 2) = temp_str
  50. Rem obtains the next row
  51. Row_numrow_num = row_num + 1
  52. Loop
  53. The password of all rem users has been generated. close the file.
  54. Close #1
  55. End Sub
  56. ?
  57. Sub gen_pass_unix ()
  58. Dim bit_count as integer 'cycle variable, password median counter
  59. Dim row_num as integer 'the row number starting with the username information for which the password is to be generated
  60. Dim rnd_base As Integer 'random number Seed
  61. Ascii value of each character in the Dim char_value As Integer 'Password
  62. Dim temp_str As String 'password String
  63. Dim username (50) As String 'User Name
  64. Dim pass_length as integer 'defines the length of the generated Password
  65. Dim start_asc as integer 'defines which character is generated from
  66. Pass_length = 8
  67. Start_asc = 48 '0
  68. Rem start_asc = 65'a
  69. Rem because unix passwords are case-sensitive, the range of random numbers is determined based on the selected Start letter to ensure
  70. Rnd_base= 122-start_asc
  71. ?
  72. Rem opens the file to output the generated Password Change script
  73. Open "c: change_pass.txt" For Output As #1
  74. At the same time, rem Records the corresponding password on the worksheet to print out the password as a record. The title is written here.
  75. Cells (1, 3) = "Username": Cells (1, 4) = "Password"
  76. Row_num = 2
  77. Rem if the third column is not empty, create a password. Otherwise, exit Do While Cells (row_num, 3) <> ""
  78. Temp_str = ""
  79. For bit_count = 1 To pass_length
  80. Char_value = start_asc + Int (Rnd (1) * rnd_base)
  81. Rem 91-94 is [] ^ _'
  82. Because rem does not want to include such characters in a unix password string, it reduces the number of counters that have been increased to ensure the length of the password. At the same time, it is not included in the password string to exclude them.
  83. If (char_value> = 58 And char_value <= 64) Or (char_value> = 91 And char_value <= 96) Then
  84. Bit_countbit_count = bit_count-1
  85. Else
  86. Temp_strtemp_str = temp_str + Chr $ (char_value)
  87. End If
  88. Next bit_count
  89. Print #1, "user" + Cells (row_num, 1) + ":" + temp_str
  90. Cells (row_num, 4) = temp_str
  91. Rem obtains the next row
  92. Row_numrow_num = row_num + 1
  93. Loop
  94. The password of all rem users has been generated. close the file.
  95. Close #1
  96. End Sub

Implementation of oracle multi-column subquery

Oracle memory structure-SGA

Oracle connect role permission changes

ORACLE Database Encoding

Oracle multi-Table query instance

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.