Tech Bloopers

Dairy of a Techie

Archive for the ‘ARCHITECTURE’ Category

Oracle Architecure

Redhat vs Solaris – In DBA perspective

Posted by TechBloopers on July 30, 2012

ORACLE
REDHAT
SOLARIS
Root filesystem
/ {/dev/sda1}
/  {/dev/vx/dsk/rootvol}
Home Directory
/export/home
/export/home {/dev/vx/dsk/home}
SAMPLE CONFIGURATION FILES
Password files
/etc/passwd
/etc/passwd 
/etc/shadow
/etc/shadow
Groups file
/etc/group
/etc/group
Maximum # of user ID
65535
2147483647
Allow/Deny remote login
/etc/securetty
/etc/default/login
{ttyp1}
{CONSOLE=/dev/console}
User nobody’s id #
99
60001 & 65534(nobody4)
Group nobody’s id #
99
60002 & 65534(nogroup)
Recover root password
{lilo}
boot cdrom -s
control-x
mkdir /tmp/a
linux S
mount /dev/c0t0d0s0 /tmp/a
passwd root
vi /tmp/a/etc/shadow
{grub}
c
kernel vmlinuz-2.4.9-13 single   ro root=/dev/hda8
initrd /initrd-2.4.9-13.img
boot
passwd root
Create new user
useradd
useradd
Delete user
userdel
userdel
List users
logins
Modify user account
usermod
usermod
Unique host ID
hostid
hostid
Administrator
linuxconf
admintool
Performance monitor
top
top
System activity reporter
sar
Virtual Memory statistics
vmstat
vmstat
I/O statistics
iostat
Error logs
dmesg 
dmesg
Physical RAM
64 GB {>2.3.24}
16TB
Shared Memory
sysctl kernel.shmmax
Process Data Space
900 MB
Swap device
/dev/sda2
/dev/vx/dsk/swapvol
Swap file type
partition type 82 
swap
Display swap size
free
swap -l
Activate Swap
swapon -a
swap -a
Printer Queues
/var/spool/lpd/lp/*
/etc/lp/interfaces/*
Stop LP 
/etc/init.d/lpd stop
/usr/lib/lp/lpshut
Start LP
/etc/init.d/lpd start
/usr/lib/lp/lpsched
Submit print jobs
lpr
lp
lpr
LP statistics
lpq
lpstat
Remove print jobs
lprm
cancel
lprm
Add printer queue
printtool
lpadmin -p pq
Remove Printer queue
lpadmin -x pq
Make default printer
lpadmin -d pq
Network IP configuration
/etc/sysconfig/network-scripts/ 
/etc/hostname.*
/etc/inet/*
/etc/defaultrouter
Hosts IP addresses
/etc/hosts
/etc/inet/hosts
Name service switch
/etc/nsswitch.conf
/etc/nsswitch.conf
Network parameters
sysctl -a | grep net
ndd /dev/[tcp|ip] ?
Routing daemon
routed
in.routed
NIC Configurations
ifconfig -a
ifconfig -a
Secondary IP Address
modprobe ip_alias
ifconfig hme0:1 IP up
ifconfig eth0:1 IP
Login prompt
/etc/issue
BANNER @
/etc/default/telnetd
Increase the # of pseudo-terminals
cd /dev
{/etc/system}
./MAKEDEV -v pty
set pt_cnt = #   {SYSV}
set npty = #      {BSD}
{/etc/iu.ap}
ptsl 0 # ldterm ttcompat
halt
boot -r
Maximum # of ptys
256
176                {BSD}
3000              {SYSV}
Remote Shell
rsh
rsh
YP/NIS service binder
/sbin/ypbind
/usr/lib/netsvc/yp/ypbind
NFS exported
/etc/exports
/etc/dfs/dfstab
/etc/dfs/sharetab
NFS Client mounted directories
/var/lib/nfs/xtab
/etc/rmtab
Max File System
2 TB 
1 TB
8000 TB {vxfs}
Max File Size
2 GB     {512B block size} 
1 TB
8192 GB  {8KB block size} 
2 GB {=<2.5.1}
Max # File Descriptors
sysctl fs.file-max
64 K
Filesystem table
/etc/fstab
/etc/vfstab
Free disk blocks
df -k
df –k
Device listing
cat /proc/devices
Sysdef
Disk information
cat /proc/scsi/scsi0/sda/model
format -d c#t#d#
format>current
format>inquiry
Disk Label
fdisk -l
Prtvtoc
LVM Concepts
logical extents
sub disk
logical volume
Volume
Plex
volume group
disk group
Journal Filesystem type
ext3
Vxfs
reiserfs
Default volume group
/dev/vx/dsk/rootdg
Display volume group
vgdisplay -v
vxprint -l -g rootdg
Modify physical volume
pvchange
Prepare physical disk
pvcreate
Vxdiskadd
List physical volume
pvdisplay
vxprint –dl
Remove disk from volume group
vgreduce
vxdg rmdisk
Move logical volumes to another physical volumes
pvmove
vxassist move
Create volume group
vgcreate
vxdg init
Remove volume group
vgremove
Volume group availability
vgchange
Restore volume group
vgcfgrestore
Exports volume group
vgexport
vxdg deport
Imports volume group
vgimport
vxdg import
Volume group listing
vgscan
Change logical volume characteristics 
lvchange 
vxedit set
List logical volume
lvdisplay
vxprint –vl
Make logical volume
lvcreate
vxassist make
Extend logical volume
lvextend
vxassist growto
Reduce logical volume
lvreduce
vxassist shrinkto
Remove logical volume
lvremove
vxedit rm
Prepare boot volumes
lilo
vxbootsetup
Remove boot volumes
Extend File system
resize2fs
Vxva
resize_reiserfs
mkfs –M
Reduce/Split mirrors
lvsplit
Merge mirrors
lvmerge
Create mirrors
vxassist mirror
Add mirrors
Create striped volumes
lvcreate -i 3 -I 64
vxassist make vol 100mb layout=raid5
System recovery tape
Backup
tar cvf /dev/rst0 /
Ufsdump
Restore
tar xvf /dev/rst0 
Ufsrestore
Startup script
/etc/rc.d/rc
/etc/init.d
Kernel
/boot/vmlinuz
/kernel/genunix
Kernel Parameters
sysctl -a
sysdef –i
Reconfigure the kernel
cd /usr/src/linux 
vi /etc/system
make mrproper 
Reboot
make menuconfig 
make dep 
make clean 
make bzImage
make install
make modules
make modules_install
cp arch/i386/boot/bzImage /boot/vmlinuz-2.2.16
mkinitrd /boot/initrd-2.2.16.img 2.2.16
vi /etc/lilo.conf
lilo
List modules
lsmod
Modinfo
Load module
insmod
Modload
Unload module
rmmod
modunload
Initialize system
netconf
sys-unconfig
Physical RAM
free
Prtconf
Kernel Bits
getconf LONG_BIT
isainfo –kv
Crash utility
Crash
Trace System Calls
strace
Truss
Machine model
uname -m
uname -imp
OS Level
uname -r
uname –r
Run Level
runlevel
who –r
Core dump files
/var/crash/`uname -n`
Boot single user
{lilo}
ok boot –s
control-x
linux S
{grub}
c
kernel vmlinuz-2.4.9-13 single   ro root=/dev/hda8
initrd /initrd-2.4.9-13.img
boot
Maintenance mode
ok boot -as
Interrupt Key
Stop-A
Return to console
ok go
Timezone Management
/etc/sysconfig/clock
/etc/TIMEZONE
/etc/default/init
NTP Daemon
/etc/ntp.conf
/etc/inet/ntp.conf
/etc/rc.d/init.d/xntpd
/etc/init.d/xntpd
Install Software
rpm -i package
Pkgadd
Uninstall software
rpm -e package
Pkgrm
List installed software
rpm -qa
Pkginfo
Verify installed software
rpm -V package
pkginfo –i
pkginfo –p
List all files
rpm -ql package
pkgchk -l package
List installed patches
patchadd -p
Package owner
rpm -qf file
pkgchk -l -p path
SW Directory
/var/lib/rpm
/var/sadm
Devices
/dev
/devices
Install devices for attached peripherals
/dev/MAKEDEV
Drvconfig
Devlinks
Disks
Tapes
Ports
Remove device
rem_drv
Device drivers
prtconf –D
CPU
cat /proc/cpuinfo
psrinfo –v
List Terminal
pmadm –l
Diagnostics
lspci
/usr/platform/`uname -m`/
pnpdump
sbin/prtdiag
ok test-all
/opt/SUNWvts/bin/sunvts
Whole Disk
/dev/sda
/dev/c#t#d0s2
CDROM
/dev/cdrom
/dev/dsk/c#t6d0s2
CDROM file type
iso9660
Hsfs
Rewinding tape drive
/dev/rst0               { c 9 0}
/dev/rmt/0
Non-rewinding tape drive
/dev/nrst0           { c 9 128 }
/dev/rmt/0n
Floppy drive
/dev/fd0
/dev/diskette
Enhanced by Zemanta

Posted in ARCHITECTURE | Leave a Comment »

TRANSACTIONS

Posted by TechBloopers on July 25, 2012

A transaction is a sequence of SQL statements that Oracle treats as a single unit of work. Oracle supports transactions as defined by the SQL standard. As soon as the database is connected with sqlplus, a transaction begins. Once the transaction begins, every SQL DML (Data Manipulation Language) statement issued subsequently becomes a part of this transaction. A transaction ends when database is disconnected or when a COMMIT or ROLLBACK command is issued.

COMMIT makes permanent any database changes made during the transaction. Until commit is issued, other users cannot see the changes. ROLLBACK clears the current transaction and undoes any changes made since the transaction began. After the current transaction has ended with a COMMIT or ROLLBACK, the first executable SQL statement issued subsequently will automatically begin another transaction.
For example, the following SQL commands have the final effect of inserting into table R the tuple (3, 4), but not (1, 2):
insert into R values (1, 2);
rollback;
insert into R values (3, 4);
commit;
With this option set to ON each individual SQL statement is treated as a transaction, which will be automatically committed right after it is executed. Command to enable, disable, display AUTOCOMMIT option is given below.
SET AUTOCOMMIT ON
SET AUTOCOMMIT OFF
SHOW ALL   –Display current setting for all options
The same rules applies for programs interacting with Oracle like Pro*C or JDBC. Pro*C doesn’t support the AUTOCOMMIT option whereas JDBC does and it has a default AUTOCOMMMIT option set to ON.
Note: Oracle automatically issues an implicit COMMIT before and after any DDL (Data Definition Language) statement (even if this DDL statement fails) .
SAVEPOINT is the concept of storing current state in the processing of a transaction.
Commands
–Creates a savepoint named .
SAVEPOINT  <sp_name>
–To undo parts of a transaction back till a savepoint
ROLLBACK TO
Example,
insert into emp values (5, 6);
savepoint my_sp_1;
insert into emp values (7, 8);
savepoint my_sp_2;
insert into emp values (9, 10);
rollback to my_sp_1;
insert into emp values (11, 12);
commit;
The above set of commands will result in inserting into table emp records (5, 6) and (11, 12), but not (7, 8) or (9, 10)
Enhanced by Zemanta

Posted in ARCHITECTURE | Leave a Comment »

Oracle Processes

Posted by TechBloopers on July 19, 2012

Oracle background process (Photo credit: Wikipedia)
Server Processes
Oracle creates server processes to handle the requests of user processes connected to the instance. In some situations when the application and Oracle operate on the same machine, it is possible to combine the user process and corresponding server process into a single process to reduce system overhead. However, when the application and Oracle operate on different machines, a user process always communicates with Oracle through a separate server process.
Server processes (or the server portion of combined user/server processes) created on behalf of each user’s application can perform one or more of the following:
  • Parse and run SQL statements issued through the application
  • Read necessary data blocks from datafiles on disk into the shared database buffers of the SGA, if the blocks are not already present in the SGA
  • Return results in such a way that the application can process the information
To maximize performance and accommodate many users, a multiprocess Oracle system uses some additional Oracle processes called background processes.
An Oracle instance can have many background processes; not all are always present. The background processes in an Oracle instance include the following:
On many operating systems, background processes are created automatically during instance startup.
Enhanced by Zemanta

Posted in ARCHITECTURE | Leave a Comment »

Semaphore

Posted by TechBloopers on July 19, 2012

A semaphore can be thought of as a counter that is used to control access to a shared resource. Semaphores provide low level synchronization between processes (or threads within a process) so that only one process (or thread) has access to the shared segment, thereby ensuring the integrity of the shared resource.

Oracle recommeds setting some of the semaphore parameters to the largest PROCESS instance parameter setting in the database parameter files for all database hosted in the Linux system plus 10.
In Linux environments semaphore is controlled by parameter kernel.sem. This parameter is set along with other parameters in the configuration file /etc/sysctl.conf.
Following commands helps to check the current setting of semaphore parameter
# cat /etc/sysctl.conf | grep sem
# sysctl -a | grep kernel.sem
# ipcs -l
Example
# cat /etc/sysctl.conf | grep sem
kernel.sem = 250 32000 100 128
# sysctl -a | grep kernel.sem
kernel.sem = 250 32000 100 128
# ipcs -l
—— Shared Memory Limits ——–
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 100663296
min seg size (bytes) = 1
—— Semaphore Limits ——–
max number of arrays = 1000
max semaphores per array = 1000
max semaphores system wide = 32000
max ops per semop call = 1000
semaphore max value = 32767
—— Messages: Limits ——–
max queues system wide = 16
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536
To change the semaphore settings, the “kernel.sem” parameter value need to be changed in the /etc/sysctl.conf. This change wont take effect until server is rebooted. In order to make the change to take effect immediately the following command need to be executed.
# sysctl -p
Enhanced by Zemanta

Posted in ARCHITECTURE | 1 Comment »

Oracle Features Summary

Posted by TechBloopers on July 2, 2012

Oracle 9i Features:

  • Connect internal (SVRMGR) is not supported in 9i now you can manage database with SQL*plus.
  • SPfile in 9i which is not available in previous version. Helpful for those init parameter those need server reboot.
  • SGA is dynamic i.e buffer cache and shared pool can be dynamically increased or decreased.
  • By default now table-space are locally managed to improve performance as free space management is done in the header of the data file instead of dictionary.
  •  Default TEMP table space and default UNDO table space can be specified at the create database statement level.
  • dbms_meta data a new package introduced which helps to generate DDL from the database instead of writing PL/SQL Block.
  •  Multiple block size support.
  •  Merge statement is introduced in Oracle 9i.
  • ANSI Support for join i.e inner-join outer-join left-outer join keyword introduced instead of operator (+)
  • newly introduced Rollback segment management (UNDO)

Oracle 10g Features:

  • Transparent Data Encryption
  • Async commits
  • CONNECT ROLE can not only connect
  • Passwords for DB Links are encrypted
  • New asmcmd utility for managing ASM storage
  • Grid computing – an extension of the clustering feature (Real Application Clusters)
  • Manageability improvements (self-tuning features)
  • Performance and scalability improvements
  • Automated Storage Management (ASM)
  • Automatic Workload Repository (AWR)
  • Automatic Database Diagnostic Monitor (ADDM)
  • Flashback operations available on row, transaction, table or database level
  • Ability to UNDROP a table from a recycle bin
  • Ability to rename table spaces
  • Ability to transport table spaces across machine types (E.g Windows to Unix
  • New ‘drop database’ statement
  • New database scheduler – DBMS_SCHEDULER
  • DBMS_FILE_TRANSFER Package
  • Support for big file table spaces that is up to 8 Exabytes in size
  • Data Pump – faster data movement with expdp and impdp.

Oracle Database 11g Features

  • Database replay – captures actual production workload and replays it on a separate system.
  • SQL performance analyzer – finds and fixes SQL performance degradations
  • Eliminates need for file systems. Very fast access of files.
  • Store all your data in the database with one consistent:, Security and auditing model
  • Backup and recovery mechanism Storage management (ASM) Transaction and concurrency model Interface and protocol Values added services like encryption, compression, and de-duplication.
  • Fast bulk data transfers
  • Secure Files compression, encryption and optimization Installs/Reinstalls and other fun on weekends. Fast-Start Failover for maximum performance mode in a Data Guard configuration.
  • Compression of redo traffic (for Gap Resolution) over the network in a Data Guard Configuration.
  • Real-Time query of a physical standby database while redo apply is active.
  • Dynamic setting of Oracle Data Guard SQL applies parameters.
  • A physical standby database can be opened temporarily for reporting and testing. Redo is still applied while database is in this state.
  • Online database upgrades for data guard physical standby. Can upgrade logical standby database, then run both in parallel, then switch them. Can take standby databases, and take them out of standby to do testing and can then move them back into standby modes.
  • RAC enhancements in OEM for monitoring and diagnostics. A lot of nice enhancements.
  • Improved metrics.
  • Next generation RAC cache fusion is even more scalable.
  • Query results caches
  • Fast caching of query/function results for read-mostly data
  • A Virtual Private Catalog can now make sure an RMAN user can only see databases they are authorized to use.
  • Archive log management for Streams and Data Guard
  • Network aware DUPLICATE
  • Optimized undo backup
  • Improved corrupt block detection
  • A new MEMORY_TARGET parameter that will improve the automatic memory management across shared and private memory areas.
  • Simplified Temp Space Management
  • Enhanced OFA Support
  • Server side connection pooling.
  • Secure configuration install option
  • Stronger Password Protection
  • Improved statistics generation for partitioned objects.
  • Security enhancements with transparent table space and LOB encryption.
  • SQL Repair Advisor
  • Automatic Diagnostic Repository (ADR)
  • Fast ANALYZE: Finding Table-Index Corruptions
  • Automatic SQL Tuning with Self-Learning Capabilities that can identify top SQL statements and tunes them automatically by creating SQL profiles.
  • Better SQL plan management allows the optimizer to maintain a history of execution plans for a SQL statement. The optimizer can move to a new plan when it able to verify it is more efficient than an old plan.
  • Streams management improves with automated alerts for Streams, a new DBMS_COMPARISON package than can help evaluate the consistency of data across databases, splitting and remerging of streams, LCR marking and tracking for diagnosing configuration issues, views and interfaces for understanding a Streams topology and a Streams Performance Advisor.
  • Migration of DBMS_JOB jobs to the Oracle scheduler.
  • SQL Test Case Builder
  • Automatic Health Monitoring
  • Manage and schedule jobs across multiple databases. This includes external jobs (i.e. shell scripts).
  • New facilities to capture and manage relevant information for incidents to speed support processes
  • Support workbench.
  • Repair advisors (coming in future releases)
  • Speed analysis of root cause for faults
  • Advice dbas on repair strategy
  • The goal is to cut down on the trace files that are sent to Oracle.
  • Support for ASM File Access Control, ASM Manageability, ASM Rolling Migrations, OCR and Voting, Disk in ASM, Disk Resync, Disk Zones, and Infrastructure. Security enhancements with ACL and Security Classes.
  • Database cloning enhancements.
  • Expected enhancements to the Database Home Page and Performance change as well as improved metrics, archiving and purging tracing and alert files, group copy of tns names.ora and viewing trace files, management of Oracle Text Indexes,
  • New Log Miner enhancements in Enterprise Manager.
  • Fine-Grained Access Control on Network Call-outs from the Database. New packages DBMS_TCP_AMIN and
  • DBMS_IMADDR_ADMIN can control which hosts on the Internet an Oracle user can access with PL/SQL packages.
  • Secure service registration with the listener out of the box.
  • New facilities to capture and manage relevant information for incidents to speed support processes
  • Support workbench.
  • Repair advisors (coming in future releases)
  • Speed analysis of root cause for faults
  • Advise DBAs on repair strategy
  • The goal is to cut down on the trace files that are sent to Oracle.
  • Faster Data Guard.
  • Faster simple SQL operations. Faster SQL with caching of frequently used SQL results.
  • Faster DML triggers.
  • Faster upgrades.
  • Faster PL/SQL and Java (auto native compilation). Caching of frequently used procedures and functions results.
  • Faster statistics generation.
  • Faster sort operations.
  • Compression and encryption enhancements
  • Support for XML Schemas and schema-based tables.
  • Transportable partitions
  • New DETECT option for unusual records.
  • New MAP option for detecting profiles.
  • New PROFILE feature for find defined patterns.
  • New analytics and data mining
  • A new SYSASM role allows the separation of database management and storage management responsibilities.
  • ASM Fast Disk Resync brings a repaired ASM disk on line in a much shorter time.
  • ASM manageability gets better with enhancements to the ASMCMD utility, a new mount mode for rebalance performance, disk group metadata backup and improved disk group compatibility across software versions.
  • Virtual columns (functions) on tables. Indexes on virtual columns.
  • Enhancements to DBMS_SQL supporting LOBS, user-defined types and bulk operations.
  • Enhanced passwords (case sensitive and enhanced password algorithm).
  • Security on ports and URLs for FGAC (i.e. UTL_HTTP, UTL_SMTP, UTL_TCP).

Posted in ARCHITECTURE | Tagged: , , , , , , , | Leave a Comment »