Thursday, June 29, 2006

Microsoft Genuine Advantage Uninstall

How to disable or uninstall the pilot version of Microsoft Windows Genuine Advantage Notifications

This Microsoft update does not have an easy uninstall. Removal will require modifying the registry.

Important This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 ( Description of the Microsoft Windows registry

This article applies to the version of Microsoft Windows Genuine Advantage (WGA) Notifications that is distributed during the pilot program. For example, this version is included in the pre-release version that accompanies the Microsoft Software License Terms. To safely and easily uninstall the pilot version, you must install the general release version of WGA Notifications. If you do not install this version, you can follow the steps in this article to disable or uninstall the pilot version.

Sunday, June 25, 2006

Oracle Import Through Uncompressing Pipe

If there is not enough disk space to uncompress the dmp file, import can read from a pipe. This is similar to export into a compressing pipe.

Put this into a sh script file, and set your environment with the appropriate Oracle variables.
# The COMPRESSED dump file name.

DT=`date +%Y%m%d%H`

$(mknod $PIPENAME p)
/usr/bin/uncompress < $DMPFILE > $PIPENAME &

imp userid=user/pass file=$PIPENAME log=/tmp/imp_$DT.log fromuser=fromschemaowner touser=toschemaowner

Get IP Address & Browser

There are many sites that will get your IP address. This Dlink site is useful and without advertising.

Friday, June 23, 2006

Oracle Statistics

Implementation of automated statistics collection for application schemas in Oracle 9iR2.

dbms_stats is a supplied package, and is the recommended method of gathering statistics. dbms_utility and analyze are no longer recommended for production systems.

Table monitoring is a feature that counts the approximate number of changes to a table. dbms_stats with "gather stale" will analyze tables that have had more than 10% of their rows changed.

Determine application schemas to analyze.
Begin table monitoring for the schemas.
Schedule job to analyze stale for the schemas.

Determine application schemas to analyze.
SQL> select username from dba_users order by 1;

Begin table monitoring for the schemas.
SQL> exec dbms_stats.alter_schema_tab_monitoring('SCHEMA_NAME', TRUE)
PL/SQL procedure successfully completed.

Schedule dbms_stats without or with histograms.
exec dbms_stats.gather_schema_stats( -
ownname => 'SCHEMA_NAME', -
options => 'GATHER AUTO' -

exec dbms_stats.gather_schema_stats( -
ownname => 'SCHEMA_NAME', -
options => 'GATHER AUTO', -
method_opt => 'FOR ALL INDEXED COLUMNS SIZE 254' -

Sunday, June 18, 2006

Oracle sqlplus Hide Password

There are several ways to keep the Oracle account password off of the unix command line and away from prying eyes. Connecting as sysdba or using an operating system authenticated account avoids a password altogether.
If you would prefer to hard code a password, this method may be used. It can easily be placed in a script.

$ORACLE_HOME/bin/sqlplus /nolog << EOF
conn username/password@SID

select sysdate
from dual

Some operating systems have the "w" command.
$ w
8:55pm up 9 days, 15:59, 5 users, load average: 0.02, 0.04, 0.89
User tty login@ idle JCPU PCPU what
user1 pts/0 6:58pm 1:57 -ksh
oracle pts/2 1:37pm 25 -ksh
user2 pts/5 7:06pm 54 19 19 sqlplus -s username/pass@THESID

Using "ps" to view the process list, notice how user1 does not expose the password.
$ ps -ef|grep sqlplus
user2 24595 24458 4 19:15:32 pts/5 0:20 sqlplus -s username/pass@THESID
oracle 2758 25017 0 20:55:17 pts/3 0:00 grep sqlplus
user1 28815 28641 0 20:00:02 ? 0:00 sqlplus -s /nolog

Tuesday, June 13, 2006

Oracle Tablespace Transport

Oracle's transportable tablespace feature is can save a lot of time when copying a user's data. All objects will need to be in one tablespace, so it may not work for all environments. When a schema's objects are in one tablespace, this is a quick way to copy a schema and data.

Verify all objects are in one tablespace. Then SELECT to see any problems.
SQL> exec sys.dbms_tts.transport_set_check('TABLE_SPACE_NAME', true)

PL/SQL procedure successfully completed.

SQL> select * from sys.transport_set_violations;

no rows selected

Determine names of data files.
SQL> select file_name, file_id, tablespace_name from dba_data_files where tablespace_name='TABLE_SPACE_NAME'

---------- ------------------------------


Set the tablespace to read only.
SQL> alter tablespace TABLE_SPACE_NAME read only;

Tablespace altered.

To export transportable, user must log on as sysdba: as sysdba
File expdat.dmp will be created. The file will be small because it will contain just metadata.
$ exp transport_tablespace=y tablespaces=TABLE_SPACE_NAME

Copy data files to new location, then and set ORACLE_SID.
$ cp ...

To import transportable, the user must log on as sysdba: as sysdba
$ imp file=expdat.dmp transport_tablespace=y "datafiles=(/u02/oradata/NEWSID/ts01.dbf,/u02/oradata/NEWSID/ts02.dbf)" tts_owner=SCHEMA_OWNER_NAME

Import: Release - Production on Mon Jun 12 13:31:48 2006

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Username: username as sysdba

Connected to: Oracle9i Enterprise Edition Release - 64bit Production
JServer Release - Production

Export file created by EXPORT:V09.02.00 via conventional path
About to import transportable tablespace(s) metadata...
import done in UTF8 character set and AL16UTF16 NCHAR character set
. importing SYS's objects into SYS
. importing SCHEMA_OWNER_NAME's objects into SCHEMA_OWNER_NAME
. . importing table "TABLE1"
. . importing table "TABLE2"
Import terminated successfully without warnings.

The imported tablespace is read only and the objects have been imported.
SQL> select tablespace_name, status from dba_tablespaces where tablespace_name = 'TABLE_SPACE_NAME';

------------------------------ ---------

If desired, set the tablespace to read write.
SQL> alter tablespace TABLE_SPACE_NAME read write;

Tablespace altered.

Monday, June 12, 2006


Before there was instant messenger, there was wall and talk. The unix command wall sends a broadcast message to terminals. The message may be in a file, or the message may be typed interactively.

For interactive use type wall, then the message, then press ctrl-d.

Example on HP-UX:
testuser@host $ wall
Testing 1 2 3 ...

Broadcast Message from testuser (pts/0) Mon Jun 12 15:41:54...
Testing 1 2 3 ...

Wednesday, June 07, 2006

Quick Guide To Sudo

The very quick quide to sudo. This guide is for end users.

Sudo is configured by root to allow a user to run a command as root. If a user is granted all sudo privileges, then the user can do anything. Sudo eliminates password hassles, because the user will only need to know their own passoword.
To become root, a user would type:
$ sudo su - root
The user would be prompted for their own password.
A user can list their sudo privileges with:
$ sudo -l

Users will often be granted sudo for specific commands - such as starting and stopping a service or becoming another user. In this case, the user could (for example) start or stop a web server without needing the root password.

Application software may be installed as user appowner with group appgroup. The application files will typically be group/world read so there is limited ability to accidentally delete the files. There will typically be other users with group appgroup, so the users can do most tasks with their own account. There will be times , for example application patching, when a user will need to become the application owner. The application owner password could be shared. Alternatively, users could be granted sudo permission to become the application owner.

Sudo typically is configured to log sudo access. Sometimes this is used as a security/auditing feature. When configured to write to syslog, an entry will look like:
Jun 7 10:05:22 host001 sudo: usera : TTY=pts/1 ; PWD=/home/usera ; USER=root ; COMMAND=/usr/bin/su - oracle
Be careful when relying on these logs, as the security depends on the correct functioning of the commands that are run under sudo. For example, allowing "sudo vi /etc/hosts" will allow the user to spawn a shell as root and this will not be logged.

Alternatives to sudo are using setuid and setgid (which have significant gotchas). Solaris has Role Based Access Control, which provides more granular privileges.