How to set vim/gvim on windows?

Using the following steps one can setup vim/gvim to run on windows.

1) Add the following new variable VIM on your system. Example: VIM=C:\apps\vim\vim73 (Where C:\apps\vim\vim73 is where vim/gvim is installed)
2) Copy the file %VIM%\vimrc_example.vim as _vimrc in %VIM% folder
3) Add the following 2 lines at the end in %VIM%\_vimrc so it sets up vim for windows
source $VIM/mswin.vim
behave mswin

Advertisements

Create a database manually on windows in 11g?

-- Step 1) set up environment variables needed (ORACLE_HOME, ORACLE_SID and add ORACLE_HOME\bin to PATH)
set ORACLE_HOME=e:\oracle\11g\product\11.2.0.1
set PATH=%ORACLE_HOME%\bin;%PATH%
set ORACLE_SID=TESTDB

-- Step 2) Sample pfile (parameter file) for the instance and place it in %ORCALE_HOME%\dbs
db_name='TESTDB'
memory_target=500m
processes=150
audit_file_dest='E:\oracle\DB\TESTDB\admin\adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
diagnostic_dest=E:\oracle\DB\TESTDB\diagnostic_dest
dispatchers='(PROTOCOL=TCP) (SERVICE=TESTDBXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = ("E:\oracle\DB\TESTDB\oradata\control1.ora", "E:\oracle\DB\TESTDB\oradata\control2.ora")
compatible ='11.1.0'

-- Step 3) Create directories mentioned in the spfile
E:\>mkdir E:\oracle\DB\TESTDB\admin\adump
E:\>mkdir E:\oracle\DB\TESTDB\diagnostic_dest
E:\>mkdir E:\oracle\DB\TESTDB\oradata

-- Step 4) Creation of service for TESTDB and set startup mode to be manual
E:\>oradim -NEW -SID TESTDB -STARTMODE manual
Instance created.

-- Step 5) Start SQL*PLus to create database
E:\> sqlplus "/nolog"
SQL> connect sys/oracle as sysdba
Connected

-- Step 6) Start instance in nomount with the pfile
SQL> startup nomount pfile="E:\oracle\11g\product\11.2.0.1\dbs\initTESTDB.ora"

ORACLE instance started.

Total System Global Area 521936896 bytes
Fixed Size 2177328 bytes
Variable Size 314574544 bytes
Database Buffers 197132288 bytes
Redo Buffers 8052736 bytes

-- Step 7) Create database
SQL>
CREATE DATABASE TESTDB
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
DATAFILE 'E:\oracle\DB\TESTDB\oradata\SYSTEM01.DBF' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE 1000M
SYSAUX DATAFILE 'E:\oracle\DB\TESTDB\oradata\SYSAUX01.DAT' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE 2000M
DEFAULT TABLESPACE USERS DATAFILE 'E:\oracle\DB\TESTDB\oradata\USERS01.DBF' SIZE 50M AUTOEXTEND ON MAXSIZE 200M
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE 'E:\oracle\DB\TESTDB\oradata\TEMP01.DBF' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE 500M
UNDO TABLESPACE "UNDOTBS1" DATAFILE 'E:\oracle\DB\TESTDB\oradata\UNDOTBS01.DBF' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED
CHARACTER SET WE8MSWIN1252
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('E:\oracle\DB\TESTDB\oradata\REDO01a.LOG', 'E:\oracle\DB\TESTDB\oradata\REDO01b.LOG') SIZE 100M,
GROUP 2 ('E:\oracle\DB\TESTDB\oradata\REDO02a.LOG', 'E:\oracle\DB\TESTDB\oradata\REDO02b.LOG') SIZE 100M,
GROUP 3 ('E:\oracle\DB\TESTDB\oradata\REDO03a.LOG', 'E:\oracle\DB\TESTDB\oradata\REDO03b.LOG') SIZE 100M
EXTENT MANAGEMENT LOCAL
MAXLOGFILES 32
MAXLOGMEMBERS 4
MAXLOGHISTORY 100
MAXDATAFILES 254
MAXINSTANCES 1;

-- Step 8) Create catalog data dictionary.
SQL> @?/rdbms/admin/catalog.sql

-- Step 9) Create all structures required for PL/SQL
SQL> @?/rdbms/admin/catproc.sql

-- Step 10) Create spfile from pfile and restart instance
SQL> create spfile from pfile='E:\oracle\11g\product\11.2.0.1\dbs\initTESTDB.ora';
File created.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area 521936896 bytes
Fixed Size 2177328 bytes
Variable Size 314574544 bytes
Database Buffers 197132288 bytes
Redo Buffers 8052736 bytes
Database mounted.
Database opened.
SQL> shutdown immediate;
Database closed.
Database dismounted.
SQL> show parameter spfile;

NAME TYPE VALUE
———————————— ———– ——————————
spfile string E:\ORACLE\11G\PRODUCT\11.2.0.1\DATABASE\SPFILETESTDB.ORA

-- Step 11) How to stop/start the services and instance
-- Show service status
E:\>sc query OracleServiceTESTDB
SERVICE_NAME: OracleServiceTESTDB
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

-- Stop service, the status of the service changes to STOP_PENDING
E:\>sc stop OracleServiceTESTDB
SERVICE_NAME: OracleServiceTESTDB
TYPE : 10 WIN32_OWN_PROCESS
STATE : 3 STOP_PENDING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x1
WAIT_HINT : 0x15f90

-- Check service again after waiting for a bit
E:\>sc query OracleServiceTESTDB
SERVICE_NAME: OracleServiceTESTDB
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
(NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN))
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

-- Start service, the status will change to START_PENDING
E:\>sc start OracleServiceTESTDB
SERVICE_NAME: OracleServiceTESTDB
TYPE : 10 WIN32_OWN_PROCESS
STATE : 2 START_PENDING
(NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN))
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x7d0
PID : 3784
FLAGS :

-- Recheck status of the service
E:\>sc query OracleServiceTESTDB
SERVICE_NAME: OracleServiceTESTDB
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

-- Re-login to start the database, if you don't relogin, you will get the ORA-03113: end-of-file on communication channel error message
E:\>sqlplus "/nolog"
SQL*Plus: Release 11.2.0.1.0 Production on Sun Aug 7 10:01:21 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> connect sys as sysdba
Enter password:
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 521936896 bytes
Fixed Size 2177328 bytes
Variable Size 314574544 bytes
Database Buffers 197132288 bytes
Redo Buffers 8052736 bytes

How to monitor CPU of oracle processes on Windows?

Using QSlice one can monitor CPU usage for individual thread on a windows box. Qslice can be downloaded from the following url http://www.microsoft.com/downloads/en/details.aspx?familyid=6247BB76-13C5-4E0E-B800-53DC1B84A94C&displaylang=en

By clicking on the oracle.exe in Qslice it displays all threads and CPU usage for each thread, so using the following SQL you can match the corresponding SID.

SQL> select to_char(p.spid, 'xxxxxxxx') threadid, s.sid, s.username, s.program
from v$process p, v$session s
where p.addr=s.paddr;

Sample output:
THREADID SID USERNAME PROGRAM
——— ———- —————————— ————————-
d90 125 ORACLE.EXE (PMON)
1728 187 ORACLE.EXE (VKTM)
1660 1 ORACLE.EXE (GEN0)
d84 64 ORACLE.EXE (DIAG)
1794 126 ORACLE.EXE (DBRM)
144c 188 ORACLE.EXE (PSP0)

Window tools

Here are some of the windows tools that can be used when working on window internals.

Autoruns (autoruns.exe) – http://technet.microsoft.com/en-us/sysinternals/bb963902.aspx
Access Chk – http://technet.microsoft.com/en-us/sysinternals/bb664922.aspx
Dependency walker – http://dependencywalker.com/
List DLLs – http://technet.microsoft.com/en-us/sysinternals/bb896656.aspx
Handle Viewer – http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx
Logon Sessions – http://technet.microsoft.com/en-us/sysinternals/bb896769.aspx
Process Explorer – http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
Object viewer – http://technet.microsoft.com/en-us/sysinternals/bb896657.aspx
Service control – sc.exe (built-in tool)
Task Process List – tlist.exe (built-in tool)

Windows Tool package – http://www.microsoft.com/downloads/details.aspx?FamilyId=49AE8576-9BB9-4126-9761-BA8011FABF38&

How to tell uptime on windows?

Using one of the following commands one can tell the uptime on windows i.e. the time since the last reboot occurred.

REM on WinXP
C:> net statistics workstation | find /I “Statistics since”
Statistics since 12/28/2008 10:35 AM

REM on WinXP, Windows 2000
C:\>systeminfo | find /I “System Up Time”
System Up Time: 1 Days, 14 Hours, 18 Minutes, 51 Seconds