Search This Blog

Tuesday, 30 October 2012

Unix commands Interview questions

unix commands :-
<><><><><><><>

1.Search a file from root directory.(filename = sample.txt)
  find / -name sample.txt
2.Display the numbers in sorted order
   sort -nu
3.Display the updated lines in file
  tail -f filename
4.How to zip a Directory
  gzip -r /hom/bea/app
5.How to kill a prosess.
   kill -9 pid
6.Display all java process in unix.
    ps -ef |grep java
7.How to delete 10 lines in vi editor.
    10dd
8.How to search a string and replace tin  vi editor.
     :"%s/old string /new string/ gi"
9.How to search a string in vi editor from bottom to top.
     ?string name
10.How to insert a line above the current line in vi editor .
      esc+o
11.How to rename a file .
     mv file1 file2
12. copy the content one directory to another directory.
        cp -r dir1/file1 dir2/file2
13. How can delete blank lines in directory.
      grep -v "^$" sample > temp
      mv temp sample
14.How can replace astring in unix.
     sed "s/oldstring/newstring/g" filename
15.Syntax for zip and unzip afile.
     gzip filename
     guzip filename.gz
16.How can display top 10 disk usage files.
  du -sh *|sort -nr|head -10
17.How to retrive a field in a file.
   cut -f 1,2 stud.
18.what is command search a string in a file.
     grep
19).How to goto the end of the line in Vieditor?
     G
20).Copy 10 line in vi editor?
      10yy
21).How to go to insert mode in vi editor?
      Esc+i
22).How to search a string in a file(filename=sample,string=weblogic)?
     grep weblogic sample
23).How to copyfile from one unix to other unix system and syntax (file=sample.txt,target host=192.168.11.128,target file path=/home/bea)?
     scp -rp sample.txt username@192.168.11.128:/home/bea
24).Copy file from path to other tree structure is given below?
25).How to find out CPU utiligation?
      top
26).How to execute ascript using nohup(script name=startweblogic.sh)?
      nohup ./startWeblogic.sh &
27).Which command is used to search and replace a string?
       sed
28).wich command is used to search astring in multiple files?
      fgrep


1)How to search a string from top to bottom in vi Editor's(String =weblogic)?
A) /weblogic
2)how to save and quit from vi Editor's?
a)WQ!
3)what are the Advantages of nohup command?
A)nohup will execute the process if you layout system.
Syn:nohup &.
4)Differance b/w the ping and tracert?
A) ping                   tracert
1)It is check the connectivity.   1.It is packet information one place to
                    another place destination.
2)It is display all at a time.    2.It display only 30 hubs in tracert.    
5)How to execute unix commands in vi?
A):ls
6)tar dir1 dir2 dir3 and new_dir?
A)syn:tar -cvf new_dir.tar dir1 dir2 dir3.
7)How to display the ipaddress and portnumber?
A)netstat -anp
8)how to delete directory with recursion and force?
A)rm -rf filename.
9)How to Open a file with page to page ?
A)more filename
10)How to Hide a file (file name=tuxedo)?
A)mv tuxedo .tuxedo
11)How to do undo in vi Editor's?
A)u
12)How to goto 100 Line in Vi Editor's?
A)100L
13)How to display last 100 Line from a file?
A)tail -100 filename
14)How to Reterive the fields from a file?
A)cut
15)How to zip a directory?(/home/directory)?
A)gzip -r /home/directory
16)How to go to end of the line in Vi?
A)G
17)Display the directiory count in current dir?
A)ls -lrt !wc -l
18)How to display all files ending with "log"?
19)How to appeand data to the existing file?
A)cat>>filename
20)How to find out the diskspace of the fileSystem?
A)df -sh
21)write A syntax for the scp Commands?
A) Scp filename root@ipaddress:filename.
22)How to display the updated lines in file ?
A)tail -f filename.
23)How to display the ipaddress and portnumber?
A)netstat -anp
24)which command is used to connect to the remote server?
A)telenet ipaddress.
25)How to repalce and String in vi Editor's?
A) sed %s/oldstring/newstring/g
25)How to repalce and String in unix?
A) sed s/oldstring/newstring/g filename
26)How to display top 10 lines from a file?
A) head -10 filename.
27)syntax for tar and untar a file?
A)tar -cvf filename.tar file1 file2 file3.
  tar -Xvf filename.tar
28)How to display hiddean a file?
A)ls -a.
29)How to Delete a blank line from a filename?
A)grep "^v" sample >temp
  mv temp filename
30)How to display all cuurent running process?
A)ps -ef
31)syntax for zip and unzip file?
A)gzip filename.
  gunzip filename.gz




Monday, 29 October 2012

MSI mode in weblogic

When a Managed Server starts, it tries to contact the Administration Server to retrieve its configuration information. If a Managed Server cannot connect to the Administration Server during startup, it can retrieve its configuration by reading configuration and security files directly. A Managed Server that starts in this way is running in Managed Server Independence (MSI) mode. By default, MSI mode is enabled.
In Managed Server Independence mode, a Managed Server looks in its root directory for the following files:
      msi-config.xml—a replica of the domain’s config.xml
     SerializedSystemIni.dat
     boot.properties—an optional file that contains an encrypted version of your username
configuration files for managed server in MSI mode
If you enable replication of configuration data and if you have started the Managed Server at least once while the Administration Server was running, msi-config.xml and SerializedSystemIni.dat will already be in the server’s root directory. The boot.properties file is not replicated. If it is not already in the Managed Server’s root directory, you must create one.

If msi-config.xml and SerializedSystemIni.dat are not in the root directory, you can either:
      Copy config.xml and SerializedSystemIni.dat from the Administration Server’s root directory (or from a backup) to the Managed Server’s root directory. Then, rename the configuration file to msi-config.xml, or
      Use the -Dweblogic.RootDirectory=path startup option to specify a directory that already contains these files
Ø      you may have noticed password values that look like "{3DES}bOH6MEd8S82sxg2Nk=" in config.xml file . This is how WebLogic stores passwords encrypted with the "Triple DES" algorithm (see here for a description of 3DES).

When WebLogic stores or retrieves one of these passwords, it uses a hash key which is stored in the SerializedSystemIni.dat file.
MSI Mode and the Domain Log File
Each WebLogic Server instance writes log messages to its local log file and a domain-wide log file. The domain log file provides a central location from which to view messages from all servers in a domain.

Usually, a Managed Server forwards messages to the Administration Server, and the Administration Server writes the messages to the domain log file. However, when a Managed Server runs in MSI mode, it assumes the role of writing to the domain log file.
By default, the pathnames for local log files and domain log files are relative to the Manged Server’s root directory. With these default settings, if a Managed Server is located in its own root directory (and it does not share its root directory with the Administration Server), when it runs in MSI mode the Managed Server will create its own domain log file in its root directory. If a Managed Server shares its root directory with the Administration Server, or if you specified an absolute pathname to the domain log, the Managed Server in MSI mode will write to the domain log file that the Administration Server created.

Note: The Managed Server must have permission to write to the existing file. If you run the Administration Server and Managed Servers under different operating system accounts, you must modify the file permissions of the domain log file so that both user accounts have write permission.
MSI Mode and the Security Realm
A Managed Server must have access to a security realm to complete its startup process. If you use the security realm that WebLogic Server installs, then the Administration Server maintains an LDAP server to store the domain’s security data. All Managed Servers replicate this LDAP server. If the Administration Server fails, Managed Servers running in MSI mode use the
replicated LDAP server for security services. If you use a third party security provider, then the Managed Server must be able to access the security data before it can complete its startup process.
MSI Mode and SSL
If you set up SSL for your servers, each server requires its own set of certificate files, key files, and other SSL-related files. Managed Servers do not retrieve SSL-related files from the Administration Server (though the domain’s configuration file does store the pathnames to those files for each server). Starting in MSI Mode does not require you to copy or move the SSL-related
files unless they are located on a machine that is inaccessible.   
MSI Mode and Deployment
A Managed Server that starts in MSI mode deploys its applications from its staging directory: serverroot/stage/appName.
MSI Mode and Managed Server Configuration Changes
If you start a Managed Server in MSI mode, you cannot change its configuration until it restores communication with the Administration Server.
MSI Mode and Node Manager
You cannot use Node Manager to start a server instance in MSI mode, only to restart it. For a routine startup, Node Manager requires access to the Administration Server. If the Administration Server is unavailable, you must log onto Managed Server’s host machine to start the Managed Server.

MSI Mode and Configuration File Replication
Managed Server Independence mode includes an option that copies the required configuration files into the Managed Server's root directory every 5 minutes. This option does not replicate a boot identity file.

By default, a Managed Server does not replicate these files. Depending on your backup schemes and the frequency with which you update your domain's configuration, this option might not be worth the performance cost of copying potentially large files across a network.
MSI Mode and Restored Communication with an Administration Server
When the Administration Server starts, it can detect the presence of running Managed Servers (if -Dweblogic.management.discover=true, which is the default setting for this property). Upon startup, the Administration Server looks at a persisted copy of the file running-managed-servers.xml and notifies all the Managed Servers listed in the file of its
presence.
Managed Servers that were started in Managed Server Independence Mode while the Administration Server was unavailable will not appear in running-managed-servers.xml. To re-establish a connection between the Administration Server and such Managed Servers, use the weblogic.Admin DISCOVERMANAGEDSERVER command.
When an Administration Server starts up and contacts a Managed Server running in MSI mode, the Managed Server deactivates MSI mode and registers itself to the Administration Server for future configuration change notifications
Starting a Managed Server When the Administration Server Is Not Accessible
If a Managed Server cannot connect to the Administration Server during startup, it can retrieve its configuration by reading locally cached configuration data. A Managed Server that starts in this way is running in Managed Server Independence (MSI) mode.
Note: If the Managed Server that failed was a clustered Managed Server that was the active server for a migratable service at the time of failure, perform the steps described in “Migrating When the Currently Active Host is Unavailable”
Clusters. Do not start the Managed Server in MSI mode.
To start up a Managed Server in MSI mode:
1. Ensure that the following files are available in the Managed Server’s root directory:
      msi-config.xml.
       SerializedSystemIni.dat
     boot.properties
If these files are not in the Managed Server’s root directory:
a. Copy the config.xml and SerializedSystemIni.dat file from the Administration Server’s root directory (or from a backup) to the Managed Server’s root directory.
b. Rename the configuration file to msi-config.xml. When you start the server, it will use the copied configuration files.
Note: Alternatively, you can use the -Dweblogic.RootDirectory=path startup option to specify a root directory that already contains these files.
2. Start the Managed Server at the command line or using a script.
Note:The Managed Server will run in MSI mode until it is contacted by its Administration Server.


Starting from version 7 WebLogic managed servers can be started in the absence of an administration server. The feature that will enable a managed server to come up in the absence of administration server (MSI mode) is enabled by default. But some of the files required for MSI mode are only sent to the managed server only when another option (MSI file replication enabled) is ON.

This feature is same in version 8 except that the config.xml being copied and cached in the managed server is stored as msi-config.xml.

In version 9 the feature is still the same except that the complete config directory that contains the configuration file is copied by default to the managed servers. But some other files like the security (*.dat) file is not copied until the MSI file replication enabled option is ON.

Version 10 alleviate all the pains by making MSI mode and MSI file replication as a default option. So out of the box a managed server is enabled to run in independence mode. And all the files required to start a managed server by itself (/config dir and *.dat file) will be automatically copied to the managed server during startup and will be synced (automatically) with the master copy (in Admin Server).

Clear cache in weblogic

What is actually WebLogic Cache?
Basically all the web-tier related files (.jsp .class, JSPCompiled files etc.,) get stored in ./wlnotdelete/app_yourapplicaiton directory. This is treated as cache whenever there is restart of a WebLogic instance happen then the WebLogic server will look-up for last serviced object status stored in the cache to service for any pending requests. Usually, when your EJB Classes need sessions, JMS object requires persistance, your web-tier may contain static contents then Cache will be used by WebLogic Application Server instance.

Why we need to remove Cache?
Whenever your application is accessed for the first time that fresh deployment of a new version, WebLogic server lookup in this directory, if there are older objects persists that will be conflict with new code objects. This is where the need of removal of cache arises.

Where there is a need of new version deployment we might need to clear the cache when the changes to the new version is not reflected. In the old version WebLogic 8.1 below we used to remove .wldonotdelete folder. In new version of WebLogic 9.x onwards removal of cache means deleting each server instance's tmp folder contains cache, stage folders or you can simply remove tmp folder too provided there should not be configuration changes happen to the server.

Generally for WebLogic 9.x and higher versions
WIN: C:\bea\user_projects\domains\yourdomain\servers\yourserver\tmp
UNIX: /bea/user_projects/domains/yourdomain/servers/yourserver/tmp

rm -rf .wlnotdelete .internal stage

you can use the following commands to clear the cache:
WIN: rd C:\bea\user_projects\domains\yourdomain\servers\yourserver\tmp \s
UNIX: rm -rf /bea/user_projects/domains/yourdomain/servers\yourserver/tmp

Here I am removing all the subdirectories and files in the the given directory.

When to do this?
After Stopping the WebLogic server instance you can go for removal of cache.
Mostly, Spring framework users, struts framework users have this no changes reflected issue for their web applications.

Weblogic interview questions


1) How many types of installations are there in weblogic ? Steps for installing weblogic in unix?  Advantage of using silent mode installation?
2) What is the command to create domain in configuration wizard? Steps for creating domain in configuration wizard?
3) What is the node manager? Advantage of using node manager ?
4) Default port number for admin, node manager and ssl ? Default multicast address? Multicast range?
5) How managed servers will communicate in cluster?
6) Difference between webserver and application server?
7) Difference between development mode and production mode?
8) Difference between unicast and mulicast?
9) What is MSI mode in weblogic? How to start managed server in msi mode ?
10) What is the difference between weblogic 8,9 and 10 versions?
11) What is the cluster in weblogic ? Cluster types and cluster algorithms ?
12) Deployment steps using admin console ?
13) Deployment using java weblogic.Deployer command?
14) Deployment using wlst?
15) What is clear cache in weblogic? when is it require to clear weblogic cache?
16) How do you take back up of existing domain ?
17) Steps for horizontal clustering?
18) What are the Deployment modes in weblogic?
19) steps for deploying applications using ant script?

Saturday, 27 October 2012

How to recover or reset weblogic console password


Steps to Reset the password for Weblogic Admin Console

Step 1. Run setDomainEnv.cmd/setDomainEnv.sh from your %DOMAIN_HOME%/bin directory to set necessary domain environment variables in command prompt for windows and shell prompt for Unix as above tool requires weblogic.jar to run.

Note: Any information below should be updated to match your directory structures and information
       %DOMAIN_HOME% -  C:\bea10\user_projects\domains\weblogic_domain\bin


Step 2. Backup or rename the DefaultAuthenticatorInit.ldift file located under your %DOMAIN_HOME%/security directory as Step 3 creates a new DefaultAuthenticatorInit.ldift file with modification specified.


Step 3. From %DOMAIN_HOME%/security directory run the below command.
"java weblogic.security.utils.AdminAccount weblogic <new_passwd> ." 



Note: There is a . (DOT) at the end of the above command which represents the Current Directory. A new “DefaultAuthenticatorInit.ldift” file will be created after the command is executed in the current directory.


Step 4. Rename the data directory to data.bkp located under your %DOMAIN_HOME%/servers/AdminServer.


Step 5. Rename all the instances of boot.properties to boot.properties.bkp located under your %DOMAIN_HOME% [if any] and %DOMAIN_HOME%/servers/AdminServer/security directory.



Step 6. Create a new boot.properties with new password as below under %DOMAIN_HOME% [if any there was earlier] and %DOMAIN_HOME%/servers/AdminServer/security directory. As recommended to avoid prompting for Username and Password while starting the Weblogic instance this step is mandatory.

boot.properties
username=weblogic
password=<new_passwd>

Note: Make sure the boot.properties is not having any extra special characters (UTF or Invisible characters) or spaces except the above two lines. Also there should be no Heading or Trailing SPACE character in these two Lines.

Step 7. Issue a Startup command to Weblogic instance and monitor the logs. If you are using Windows service for startup of Weblogic then you might also need to delete the existing windows service and install the windows service with new credentials. Please refer WebLogic Server instance as Windows Service .


Step 8. Your managed servers also needs to be started with new boot.properties. You can follow step4 to step7 or just replace all the instances of boot.properties on your managed servers with the one on AdminServer and rename the servers directory located under %DOMAIN_HOME% on managed servers. 

Step 9. Login to the console with the new password.