Monday, October 1, 2012

All About Oracle Weblogic Server




#Automated script to check Admin Server(s) and Managed Server(s) Status/Availability.
You will need to scripts for this. first is base script second is driver script. please find both below.

1. Create a file through VI editor "AllServerStatus.py" and paste below code.

#AllServerStatus.py
username = 'weblogic'
password = 'welcome1'
URL='t3://testap02.dubaiworld.ae:7001'

connect(username,password,URL)
domainConfig()
serverList=cmo.getServers();
domainRuntime()
cd('/ServerLifeCycleRuntimes/')

for server in serverList:
     name=server.getName()
     cd(name)
     serverState=cmo.getState()
     if serverState=='SHUTDOWN':
        print '**** Shutdown Servers ****'
        print 'Server *****'+ name +'***** State *****'+serverState
        break
     print 'Server *****'+ name +'***** State *****'+serverState
     cd('..') 

2. Save it.
Remember the path where you have created/copied this file as you need to supply the same in below driver script.
  
3. Create another file through VI "weblogicstatus.sh" with below contents.
#weblogicstatus.sh
#to set the wls env
sh $BEA_HOME/wlserver_10.3/server/bin/setWLSEnv.sh > /dev/null

#to check the status of running servers., modify output by adjusting tail swith, for me only last 4 lines was required.
java -cp $BEA_HOME/wlserver_10.3/server/lib/weblogic.jar weblogic.WLST $BEA_HOME/user_projects/domains/SOAOSBDevDomain/bin/AllServerStatus.py|tail -4

Make sure the above path given is correct, you can give direct path in case of issue.

4. Save it. 
5. Give execute permission on both file. 
chmod 755 <filename>
6. Script is ready, you can execute like below.
 sh weblogicstatus.sh

#How to get Weblogic Version Information

#Vesrion Info
sh $BEA_HOME/wlserver_10.3/server/bin/setWLSEnv.sh
java weblogic.version


#exact WLS version can be checked using the following commands:
cat $MW_HOME/wlserver_10.3/.product.properties | grep WLS_PRODUCT_VERSION




# Use SmartUpdate to check the Product Version:
$MW_HOME/utils/bsu/bsu.sh -view -status=applied -prod_dir=$MW_HOME/wlserver_10.3 | grep ProductVersion

# For Fusion Middleware products version, use the command Oracle Home/Opatch/opatch lsinventory and note the output:
# For the MDS version, look in the file RCU Home/rcu/log/logdir./mds.log:
# To get the schema version from the database, login to the database as sysdba and enter the command as shown
select comp_id, comp_name, version from schema_version_registry;




creating a WebLogic administrator user that has only application deployments admin rights.




1.    Open WebLogic Console.
2.    In the Domain Structure window click on Security Realms.
3.    On the right Content Pane click on security realm for which you are creating a user (for example, myrealm).
 Follow below steps.

4.    Click Users and Groups.
5.    The Users and Groups page displays all the users currently defined in the WebLogic Authentication provider's database.
6.    Click the New button link to display the Create a New User page.



7.    Enter the name of the user in the Name field. (User names are case sensitive.)
8.    Optionally, enter a description of the user (such as their full name) in the Description field.
9.    Enter a password for the user in the Password/Confirm Password fields.
10.    Click OK to save your changes.



Adding Users to Groups:
1.    In the Domain Structure window click on Security Realms.
2.    On the right Content Pane click on security realm for which you are creating a user (for example, myrealm).
3.    Click Users and Groups.
4.    Click the name of the user that we just created.



5.    Click on the Groups tab.
6.    All the groups available in the WebLogic Authentication provider's database appear in the Parent Groups box. Use the check-box to select Deployers group and click the right arrow to move it to the Chosen box.



7.    Click Save to save your changes.

Now if you log out and login as the user we just created you will see that most of the actions are disabled. This new user can manage deployments (Install/Update/Delete/Start/Stop) but nothing else. This is how you can create admin users with specific grants.

No comments:

Post a Comment