Wednesday, 29 September 2010

LINKUP


-- target server name


EXECUTE
sp_addlinkedserver
@server =
N'INSTANCENAME\DEV2005',

@srvproduct =
'',

@provider =
N'SQLOLEDB',

@datasrc =
N'TARGETINSTANCE\DEV2005',

@catalog =
N''




select
*
from
sys.servers;


-- add users who want to see that


EXECUTE
sp_addlinkedsrvlogin
@rmtsrvname =
'TARGETINSTANCE\DEV2005',

@useself =
'false',

@locallogin =
'DOMAIN\hemesh.patel',

@rmtuser =
'HM_ReadONLY',

@rmtpassword =
'passwd'


EXECUTE
sp_addlinkedsrvlogin
@rmtsrvname =
'TARGETINSTANCE\UAT2008',

@useself =
'false',

@locallogin =
'DOMAIN\AsiriF',

@rmtuser =
'HM_ReadONLY',

@rmtpassword =
'passwd'



EXECUTE
sp_droplinkedsrvlogin

@rmtsrvname =
'TARGETINSTANCE\LIVE2008'
,

@locallogin =
'DOMAIN\Gihan.Desilva'

Saturday, 25 September 2010

Uninstall Oracle 9i from Windows

The simplest way to remove Oracle is to run the Oracle installer:

Start > Programs > Oracle Installation Products > Universal Installer

  1. On the first screen click on "Deinstall Products..."
  2. Expand the tree view (just so that the second level is visible) and make sure you select everything that is selectable.
  3. Click on "Remove..."
  4. On the confirmation screen click "Yes"
  5. When it has finished click "Close" and then "Exit" to quit the installer

Whilst the Oracle installer removes many components there are a number of things that it leaves behind. In order to completely remove all traces of Oracle the following additional steps will need to be taken:

  1. Stop any Oracle services that have been left running. (Start > Settings > Control Panel > Services.)
    Services which I have found left behind are 'OracleOraHome90TNSListener' and 'OracleServiceORACLE'. However there may be others depending on your installation. Look for any services with names starting with 'Oracle'.
  2. Run regedit (Start > Run > Enter "regedit", click "Ok"), find and delete the following keys:

    HKEY_LOCAL_MACHINE
    \SOFTWARE
    \ORACLE

    HKEY_LOCAL_MACHINE
    \SYSTEM
    \CurrentControlSet
    \Services
    \EventLog
    \Application
    \Oracle.oracle


    Note: I have had it reported that some people also have registry entries saved under HKEY_CURRENT_USER\SOFTWARE\ORACLE, this registry entry may be created by some Oracle utilities. If it exists then delete it.
  3. Delete the Oracle home directory:
    "C:\Oracle"
    This will also remove your database files (unless you located them elsewhere, in which case you will need to delete them separately).
  4. Delete the Oracle program Files directory:
    "C:\Program Files\Oracle"
  5. Delete the Oracle programs profile directory:
    "C:\Documents and Settings\All Users\Start Menu\Programs\Oracle - OraHome90"
    if you did not first run the Oracle installer to remove Oracle then there may be other Oracle profile group directories to remove.
  6. Some of the Oracle services may be left behind by the uninstall. Open ‘services’ on the control panel, make a note of which Oracle services remain and see the notes ‘How to remove a service’ to remove them.
  7. If you didn't first run the Oracle Installer to remove Oracle then you may have some references to Oracle left in the path. To remove these: Start > Settings > Control Panel > System > Advanced > Environment Variables, look at both the use and system variable 'PATH' and edit them to remove any references to Oracle.

Acknowledgements: My appreciation to Alistair Jones for help on this procedure and for encouragement to write it.


These notes have been tested with Oracle 9i under Windows XP.

This page represents one page of many pages of notes I made whilst working with Oracle 7 through to 10i. I now no longer work with Oracle databases, but hope that these notes will continue to be of benefit to others.

HOW TO DELETE SERVICE IN WINDOWS

Normally it should not be necessary to manually delete a service. Uninstalling an application should remove its associated service (if any).

However, should it be necessary to manually remove a service:

  1. Run Regedit or regedt32.
  2. Fnd the registry entry:

    HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services

  3. Find the service there and delete it.
    You may wish to look at the keys and see what files the service was using and perhaps delete them also.

Note:

  • You will have to reboot before the list gets updated in server manager.
  • I have had it pointed out that some programs are cunning and prevent you from removing their service easily. (For example the spyware\malware called ‘Command Service’ - "cmdService".) These change the permissions to make it more difficult for you to delete them. For these you will have to right click on the ‘service’ in regedit (regedt32), go to permissions and grant the administrator full control before the service can be deleted.

Wednesday, 8 September 2010

SSRS Query Where clause

In The SQL SERVER ::

Where C.name IN (@country) AND (R.first_name like ISNULL( @firstName , '%%') )

AND (R.last_name like ISNULL(@lastName , '%%') )

AND (R.company_name like ISNULL( @CompanyName , '%%'))

AND ( R.email like ISNULL ( @email , '%%') )

In The Oracle ::

Where C.name IN (:country)

or

FROM TWITTER

where date_created >= :startdate and date_created <= :enddate

and channel like nvl(:channel,'%%')

and username like nvl(:username,'%%')

order by date_created asc

------> above :enddate parameter's default value '=Today()'

Sum Total:

[="Total Logins : "&Sum(Fields!No_of_Unique_Logins.Value)]

Count Total:

[="Total Users : "&count(Fields!USERNAME.Value)]

Execution Time:

="Executed On @ " + Format(Globals!ExecutionTime,"dd/MM/yyyy hh:mm:ss tt")

Report Properties:

Tital = 'Normal, Tahoma, 13pt, Medium'

Column='Normal, Cambria, 11pt, Bold'

value field='Normal, Verdana, 10pt, Normal'