Monday, September 12, 2011

Configuring iSQL*Plus for SYSDBA or SYSOPER on Oracle 9i

iSQL*Plus, is a web based SQL*Plus environment as most people call it as “Glorified” SQL*Plus. I love it as it gives a formatted output which pleases the eyes. We do not have to worry about the formatting to set the column width as in SQL*Plus. Another reason, which pull me to iSQL*Plus is its ability to reuse the command from the history unlike SQL*Plus which stores only one command in the buffer. And most importantly from Oracle 9i onward, we do not need to install any client side application and it is completely works from inside a browser.

There are two modes of access to iSQL*Plus:

  • Connect as a normal User, the default mode:

Connecting as a default mode is easy as we can simply start the http server (Apache ). Follow the path: Start-> All Programs -> Oracle- OraHome92 -> Oracle HTTP Server ->Start HTTP Server as Shown in the figure.


Now start a browser and type ipaddress/isqlplus in the address bar (e.g: localhost/isqlplus)


You can enter your user name and password in the login


  • Connect with AS SYSDBA or AS SYSOPER privileges.

To connect with SYSDBA or SYSOPER privileges, your username and password must be added to the iSQL*Plus authentication file for the Oracle HTTP Server. On installation, the authentication file is created with no user entries at %ORACLE_HOME%\sqlplus\admin\iplusdba.pw. The username and password used in the authentication file is independent of the Oracle9i username and password.

To create a new user entry in an Oracle HTTP Server authentication file.

  1. Log in to the Oracle HTTP Server as the Oracle HTTP Server administrator.
  1. Change your directory to C:\Oracle\Ora92\Apache\Apache\bin\

  1. Run the htpasswd utility to add users to the authentication file. For AS SYSDBA or AS SYSOPER users, use the form:

htpasswd %ORACLE_HOME%\sqlplus\admin\iplusdba.pw username

You are done. Now restart the HTTP server and open a browser and enter the following address ipaddress/isqlplusdba. You will be prompted for user name and password.


Once correct username and password is given, you are ready to logon as sysdba or sysoper.


Friday, July 22, 2011

Automating User Creation With VBscript In Windows Server 2003


First job I had to do when I started to administer the computer lab in my school was to add users and which is a never ending process. I started in the beginning by adding each user graphically in my Windows Server 2003 standard edition and create their home directories, share them and give appropriate permission. It was a lot of job. I needed a way to automate things. The best thing I realised was the use of VBscript. VBScript-(or Microsoft's Visual Basic Scripting Edition) is a powerful interpreted scripting language that brings active scripting to a variety of environments, both client and server side. But I will not go into VBscript and simply explain the way I have used it to accomplish my work. O'Reilly’s Windows Server Cookbook by Robbie Allen was of great help to me. Anyone, who wishes to use this code, will be able to use it with some modification in it.

I am using an excel file to store the details of the student. Sample Excel sheet is shown in the figure.

Figure 1: Sample Excel Workbook


VBscript file is as follows:(Creator.vbs)

' ------------------- SCRIPT CONFIGURATION --------------------------

strDomainName="winserver.myhome"

strExcelPath = "c:\data.xls"

strFolderPath = ""

intStartRow = 2

' -------------------- END CONFIGURATION ----------------------------

'----------------------READING FROM EXCEL--------------------

On Error Resume Next

set objExcel = CreateObject("Excel.Application")

if Err.Number <> 0 then

Wscript.Echo "Excel application not installed."

Wscript.Quit

end if

On Error GoTo 0

objExcel.WorkBooks.Open strExcelPath

set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

intRow = intStartRow

do while objSheet.Cells(intRow, 1).Value <> ""

'----------------------ASSIGN VARIABLE FROM EXCEL--------------------

strFirstName=objSheet.Cells(intRow, 1).Value

strLastName=objSheet.Cells(intRow, 2).Value

strUserName=objSheet.Cells(intRow, 3).Value

'---------------------------CREATING FOLDER--------------------------

strFolderPath = "C:\" & strUserName

set objFSO = CreateObject("Scripting.FileSystemObject")

objFSO.createFolder(strFolderPath)

'The following code creates a user object and sets several attributes.

'---------------------------------------------------------------------

set objParent = GetObject("LDAP://" & strDomainName & ".com")

set objUser = objParent.Create("user", "cn=" & strUserName)

objUser.Put "sAMAccountName", strUserName

objUser.Put "userPrincipalName", strUserName & "@winserver.com"

objUser.Put "givenName", strFirstName

objUser.Put "sn", strLastName

objUser.Put "displayName", strFirstName & " " & strLastName

objUser.Put "homeDirectory", "\\gdhome\" & objUser.Get("sAMAccountName")

objUser.Put "homeDrive", "z:"

objUser.SetInfo

objUser.SetPassword("")

objUser.AccountDisabled = FALSE

objUser.SetInfo

'------------------ SHARE FOLDER AND GRANT PERMISSION ----------------

Set wshShell = WScript.CreateObject("Wscript.Shell")

strcmd="c:\mybat.bat " & strUserName & " " & strFolderPath & " " & "winserver\Administrator"

WScript.Echo strcmd

wshShell.Run strcmd

intRow = intRow + 1

loop

objExcel.ActiveWorkbook.Close

objExcel.Application.Quit

Wscript.Echo "Done"

Most of the codes are self explanatory but when it came to the section of “SHARE FOLDER AND GRANT PERMISSION”, I could not use the VBScript anymore and had to depend on a DOS Batch file mybat.bat.

Codes for mybat.bat

net share %1=%2 /grant:%1,Change

subinacl /share %1 /grant=%3=F

How to run it:

In my case all the files are located in the c: root directory. I simply run the script by double clicking the script and wait for the message “Done”, which takes less than a minute for creating around 50 users in my machine.

Figure 2: C Drive before running Script


Figure 3: C Drive after running script

Figure 4: Users created in AD

Figure 5: File permission of mahendh

Figure 6: General tab of user properties

Figure 7: Profile of user

ISSUES that is still bothering me are:

  1. Unable to use VBscript in sharing and granting permission.
  2. When users are created, they are created in under the domain and I could not find a way to place them directly inside a container. So I had to move these users manually to the appropriate container.

I will be grateful to you if you can help me improve the codes and solve those problem.

Thursday, May 5, 2011

How to configure Tata Photon Whiz or Tata Photon Plus on Linux OS

Tata photon does not provide a dialler for Linux system but we can install and connect to the internet by configuring the modem in Linux.

Requirement:

  1. Laptop or Desktop running on Linux OS
  2. Working Tata photon whiz or Tata photon plus modem.
Screenshot shown are from Linux Mint 9. However you can use the similar step to configure any other Linux OS. Those of you using Ubuntu will find it exactly same.

STEP 1:

First off all you need to install the PPP dialler on your computer. To do so, open the Terminal and type the following command:

On Linux Mint / Ubuntu:

sudo apt-get install wvdial

or(for root user)

apt-get install wvdial


On RedHat Linux: (for root user)

yum install wvdial

On Opensuse / Suse: (for root user)

zypper install wvdial

STEP 2:

Connect the Modem to the Laptop/Desktop and ensure that the device is properly connected. Now open the Terminal and type the following command:

On Linux Mint / Ubuntu

sudo wvdialconf /etc/wvdial.conf

or(for root user)

wvdialconf /etc/wvdial.conf

On RedHat Linux / Opensuse / Suse (for root user)

wvdialconf /etc/wvdial.conf

STEP 3:

We need to edit the file /etc/wvdial.conf . We can use vi editor or any other text editor but as most of us are more comfortable with gedit we can type the following command:

On Linux Mint/Ubuntu

sudo gedit /etc/wvdial.conf

or(for root user)

gedit /etc/wvdial.conf


On RedHat Linux / Opensuse / Suse (for root user)

gedit /etc/wvdial.conf

Make the following changes in the configuration file.

1. Delete the semi colon before last three lines phone, username, password

2. Enter phone no #777 username and password internet.

3. add this 2 extra lines in the configuration file at the last

Init3 = AT+CRM=1

Stupid Mode = 1

Please find the screenshot of configuration file after all the changes are done. Save thefile and exit from the gedit application.


We are now done.

To connect to the internet , type the following command on the Terminal

On Linux Mint / Ubuntu

sudo wvdial

or(for root user)

wvdial

On RedHat Linux / Opensuse / Suse (for root user)

wvdial

Open your favourite browser and start browsing.

Press Ctrl + C to end the call.

Tuesday, May 3, 2011

Reviewing Blogs Before Posting

Sorry for the inconvenience.

Visit again for updated blogs.

With Regards
Ganapati Das.