Thursday 28 February 2019

How to Change or Reset the WebLogic Server Administrator Password


Oracle WebLogic Server - Version 8.1 and later
Information in this document applies to any platform.


This document provide steps to change or reset the WebLogic Admin Server's Administrator password using the WLS /console or weblogic.security.utils.AdminAccount tool.


For all versions, Oracle recommends that you keep your password safe and don't lose it, and also create more than one administrator account so that losing one doesn't lock you out of your environment.

WebLogic Server 12c

Using the weblogic.security.utils.AdminAccount tool is not supported on WLS 12c. Oracle does provide guidance in the lockdown guide recommending two admin accounts and safeguarding passwords. See Table 3-1 in Securing the WebLogic Server Host, rows "Limit the number of user accounts on the host machine" and "Safeguard passwords" within https://docs.oracle.com/middleware/12213/wls/LOCKD/secure.htm#GUID-4EE4FBAF-48B9-4E58-9CAD-381ABA81CC50 .
If you have two admin users, you can login as either one and use normal password mechanisms to change the password.
Normal password management is described in:
- Admin Console Online help: "Modify Users"
https://docs.oracle.com/middleware/12213/wls/WLACH/taskhelp/security/ModifyUsers.html
- Fusion Middleware Control help: "Configure user password settings"
https://docs.oracle.com/middleware/12213/wls/TASKS/security.htm#TASKS679

WebLogic Server 10.3.6 and Earlier

To change the Administrator password on WLS 10.3.6 or earlier, perform the following steps depending on your situation:
IF YOU KNOW CURRENT PASSWORD
  1. Start the Admin Server and log into /console.
  2. Go to page: Home > Summary of Security Realms > myrealm > Users and Groups > weblogic. and click on tab Passwords.
  3. Enter the new Password.
  4. Restart the server.
If you get a weblogic.security.SecurityInitializationException error, perform these additional steps on every Managed Server (or eventually the Admin Server, too):
  1. Go to folder /servers/AdminServer/security
  2. Edit the boot.properties file and change the password to the value already entered on the Admin Console. Do this for all the servers in the domain.
  3. Start the Admin Server (Weblogic Server will encrypt the password for you).
Optionally, you can force a Managed Server to connect to the embedded LDAP server on the Administration Server, instead of connecting to the local replicated LDAP server. Follow these steps:
  1. Go to page: Domain > Security > Embedded LDAP page on the Admin Console.
  2. Enable MasterFirst.
  3. Restart the server.

IF YOU DON'T KNOW CURRENT PASSWORD
If you forget your administrative password and cannot start the server, the following procedure works for the default authenticator using the embedded LDAP server and only if you have not modified the global Admin role, which by default is granted to the Administrators group. For our example, it is assumed that your server name is AdminServer. Important: Using the weblogic.security.utils.AdminAccount tool creates a new admin user, but you may lose your existing LDAP data, which includes user, groups, and policy data, so backing up your LDAP folder is recommended before executing the steps.

To reset the password, follow these steps:
  1. Make sure Weblogic Server instance is stopped.
  2. Make a backup of the LDAP folder of the admin server as well as managed servers (you may rename those folders):

    /user_projects/domains//servers//data/ldap
  3. Set your environment variables by running setDomainEnv.sh (UNIX) or setDomainEnv.cmd (Windows). For example, on UNIX:
    . ./setDomainEnv.sh (Notice the space between the dots)

  4. Create a new initialization file for the default authenticator by running the following command that creates a new DefaultAuthenticatorInit.ldift file in the $DOMAIN_HOME/security subdirectory:
    java weblogic.security.utils.AdminAccount /security

    Note: AdminAccount should be run on the Admin Server, not one of the Managed Servers.

  5. Remove the initialized status file DefaultAuthenticatormyrealmInit.initialized from the /servers/AdminServer/data/ldap/ subdirectory:
    cd /user_projects/domains//servers/AdminServer/data/ldap
    rm DefaultAuthenticatormyrealmInit.initialized

    NOTE: In some cases, it has been necessary to delete ldap directory for this process to work.
  6. Go to folder /servers/AdminServer/security
  7. Edit the boot.properties file and change the password to the value already used on the previous step. Do this for all the servers in the domain.
  8. Start Weblogic Server (Weblogic Server will encrypt the password for you).

IMPORTANT:

Keep in mind that we are not just changing the password for the Admin Console, but we are rather changing it for the Admin User (which may connect in many different ways to Admin Server).

Remember to use the new password (once successfully changed), when when connecting to WLST, start the managed servers or using weblogic.Admin utility.

Monday 4 February 2019

How to Create the Datasource using Python script in WebLogic 11g

Step 1: Create Datasource.py

#!/usr/bin/python

import time
import getopt
import sys
import re

# Get location of the properties file.
properties = ''
try:
   opts, args = getopt.getopt(sys.argv[1:],"p:h::",["properies="])
except getopt.GetoptError:
   print 'set_datasource.py -p '
   sys.exit(2)
for opt, arg in opts:
   if opt == '-h':
      print 'set_datasource.py -p '
      sys.exit()
   elif opt in ("-p", "--properties"):
      properties = arg
print 'properties=', properties

# Load the properties from the properties file.
from java.io import FileInputStream

propInputStream = FileInputStream(properties)
configProps = Properties()
configProps.load(propInputStream)

# Set all variables from values in properties file.
adminUsername=configProps.get("admin.username")
adminPassword=configProps.get("admin.password")
adminURL=configProps.get("admin.url")
dsName=configProps.get("ds.name")
dsJNDIName=configProps.get("ds.jndi.name")
dsURL=configProps.get("ds.url")
dsDriver=configProps.get("ds.driver")
dsUsername=configProps.get("ds.username")
dsPassword=configProps.get("ds.password")
dsTargetType=configProps.get("ds.target.type")
dsTargetName=configProps.get("ds.target.name")

# Display the variable values.
print 'adminUsername=', adminUsername
print 'adminURL=', adminURL
print 'dsName=', dsName
print 'dsJNDIName=', dsJNDIName
print 'dsURL=', dsURL
print 'dsDriver=', dsDriver
print 'dsUsername=', dsUsername
print 'dsTargetType=', dsTargetType
print 'dsTargetName=', dsTargetName

# Connect to the AdminServer.
connect(adminUsername, adminPassword, adminURL)

edit()
startEdit()

# Create data source.
cd('/')
cmo.createJDBCSystemResource(dsName)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName)
cmo.setName(dsName)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDataSourceParams/' + dsName)
set('JNDINames',jarray.array([String(dsJNDIName)], String))

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName)
cmo.setUrl(dsURL)
cmo.setDriverName(dsDriver)
set('Password', dsPassword)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCConnectionPoolParams/' + dsName)
cmo.setTestTableName('SQL SELECT 1 FROM DUAL\r\n\r\n')

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName)
cmo.createProperty('user')

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName + '/Properties/user')
cmo.setValue(dsUsername)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDataSourceParams/' + dsName)
cmo.setGlobalTransactionsProtocol('TwoPhaseCommit')

cd('/SystemResources/' + dsName)
set('Targets',jarray.array([ObjectName('com.bea:Name=' + dsTargetName + ',Type=' + dsTargetType)], ObjectName))

save()
activate()

disconnect()
exit()

Step 2: for XA Data source properties file
fileName: DS.properties

# AdminServer connection details.
admin.username=weblogic
admin.password=teste123
admin.url=t3://app1weblogic002d:7001

ds.name=DsDoJackXA
ds.jndi.name=jdbc/DoJackXA
ds.url=jdbc:oracle:thin:@db1grepora1p:1521/dbcore
ds.driver=oracle.jdbc.xa.client.OracleXADataSource
ds.username=scott
ds.password=tiger

ds.target.type=Cluster
ds.target.name=WLS_Teste_Cluster


Step3: for noXA properties file

Filename: DSnoXA.properties

# AdminServer connection details.
admin.username=weblogic
admin.password=teste123
admin.url=t3://app1weblogic002d:7001

ds.name=DsDoMaiquelNoXA
ds.jndi.name=jdbc/DoMaiquelNoXA
ds.url=jdbc:oracle:thin:@db1grepora1p:1521/dbcore
ds.driver=oracle.jdbc.OracleDriver
ds.username=scott
ds.password=tiger

ds.target.type=Cluster
ds.target.name=WLS_Teste_Cluster

Step 4:

Below steps for   create XA datasource:

[oracle@kumarSunkara]$ source setDomainEnv.sh
[oracle@kumarSunkara]$ java weblogic.WLST Datasource.py -p DS.properties

and  Below Steps for create NoXA datasource:

[oracle@kumarSunkara~]$ source setDomainEnv.sh
[oracle@kumarSunkara]$ java weblogic.WLST createDS.py -p DSnoXA.properties

WebLogic Admin server is not started:Server subsystem failed. Reason: java.lang.NumberFormatException: null java.lang.NumberFormatException: null

Cause:

Solution:

Take backup of replicas.prob and start Admin Server or Managed servers. then it will run successfully. Please find the below location of  the file.
>>> /SOA/oracle/soaosb/admin/soaosb_domain/aserver/soaosb_domain/servers/AdminServer/data/ldap/conf]
[soa]-->ls -rlt
total 8
-rw-r----- 1 oracle dba 568 Jun 19  2014 vde.prop
-rw-r----- 1 oracle dba   0 Jun 19  2014 mapping.cfg
-rw-r----- 1 oracle dba   0 Feb  4 09:26 replicas.prop_bkp
-rw-r----- 1 oracle dba  14 Feb  4 09:44 replicas.prop





Saturday 3 November 2018

Oracle Service Bus Deployment and Remove the Deployed OSB Components


The deployment process is:

1.     Open the Oracle Service Bus (OSB) (http://osb-as-vip.soa-{deployment-environment}.bcc.qld.gov.au:7001/sbconsole) and login using an admin account
2.     On the left navigation bar, Change Center, click Create to create a new session
3.     On the left navigation bar, click System Administration
4.     On the left navigation bar, click Import Resources
5.     Click Browse
6.     Select the deployment archive (.jar) file (dart-application-sbconfig-01.01.00.jar)
7.     Click Next
8.     Click Import
9.     On the left navigation bar, click Execute Customization File
10.  Click Browse
11.  Select the deployment customisation file ({deployment-environment}-dart-application-osb-customization-01.01.00.xml)
11.1        If the following files are not attached to a relevant ITSM7 task, extract them from the Development PVCS project (\\pvcs-prd\pvcs\Development) in the location /Application/Component/Service/dart-application/deployment

dart-application-sbconfig-01.01.00.jar
{deployment-environment}-dart-application-osb-customization-01.01.00.xml

Ensure the revisions labelled with the version label 01.00.00 are the revisions that are extracted.
11.2        A separate deployment customisation file will exist for each target environment. The customisation file for each environment will contain the appropriate settings for that environment.
Environment
Customisation File
DEV
dev-dart-application-osb-customization-01.01.00.xml
TST
tst-dart-application-osb-customization-01.01.00.xml
UAT
uat-dart-application-osb-customization-01.01.00.xml
PRD
prd-dart-application-osb-customization-01.01.00.xml

12.  Click Next
13.  To ensure that only the newly loaded items are altered, select the check box Only Items Changed In Current Session.
14.  Click Execute
15.  On the left navigation bar, Change Center, click Activate to create a new session
16.  Enter the description of: Deployment of DART Application Component Service OSB component revision 01.01.00.
17.  Click Submit



Process to Remove the Deployed OSB Components

1.     Open the Oracle Service Bus (OSB) (http://osb-as-vip.soa-{deployment-environment}.bcc.qld.gov.au:7001/sbconsole) and login using an admin account
2.     On the left navigation bar, Change Center, click View Changes.
3.     Identify the update to be rolled back using the description and execution time to assist.
4.     In the Options column, click the Click to undo this task icon.
5.     The update will now have a task status of Undone.

SOA Composite Deployment and Remove the Deployed Composite


The deployment process is:

1.     Open the Oracle Enterprise Manager (EM) (http://soa-as-vip.soa-{deployment-environment}.com:7002/em) and login using an admin account
2.     On the left navigation bar, click WebLogic Domain > soa_domain.
3.     Right click soa_cluster.
4.     Select SOA Deployment > Deploy
5.     Select the Service archive (SAR) file (sca_dart-application-composite_rev01.01.00.jar)
6.     Select the Configuration Plan file (({deployment-environment}-dart-application-composite_cfgplan-01.01.00.xml)
6.1  If the following files are not attached to a relevant ITSM7 task, extract them from the Development PVCS project (\\pvcs-prd\pvcs\Development) in the location /Application/Component/Service/dart-application/deployment

sca_dart-application-composite_rev01.01.00.jar
({deployment-environment}-dart-application-composite_cfgplan-01.01.00.xml

Ensure the revisions labelled with the version label 01.01.00 are the revisions that are extracted.
6.2  A separate deployment customisation file will exist for each target environment. The customisation file for each environment will contain the appropriate settings for that environment.
Environment
Customisation File
DEV
dev-dart-application-composite_cfgplan-01.01.00.xml
TST
tst-dart-application-composite_cfgplan-01.01.00.xml
UAT
uat-dart-application-composite_cfgplan-01.01.00.xml
PRD
prd-dart-application-composite_cfgplan-01.01.00.xml

7.     Select Next
8.     Select the WebLogic cluster (Farm_soa_domain/soa_domain/soa_cluster) to deploy the composite
9.     Select Next
10.  Confirm that the application will deploy as default revision
11.  Select Deploy
12.  Check the displayed message for any errors.


         Process to Remove the Deployed Composite

1.     Open the Oracle Enterprise Manager (EM) (http://soa-as-vip.soa-{deployment-environment}.com:7002/em) and login using an admin account
2.     On the left navigation bar, click WebLogic Domain > soa_domain.
3.     Right click soa_cluster.
1.     Select SOA Deployment > Undeploy
4.     Select the radio box to the left of the composite to be rolled back.
5.     Click the Next button.
6.     Click the Undeploy button.
7.     Check the displayed message for any errors.