Escaping
========
1. Single quotes protect all special characters except single quote
e.g. $echo ‘Hi, “ life is all about making sense out of non sense – By Sybanurag’
output – Hi, “ life is all about making sense out of non sense – By Sybanurag

2. Double quotes don’t protect double quotes and $ and `(backquote)
e.g. $echo “Hi, “ life is all about making sense out of non sense – By Sybanurag”
output — Hi, life is all about making sense out of non sense – By Sybanurag

Process Basics
===========
1. When two users run the same same program, there is one program on disk but two processes in memory.

Problem 1
——–
Can a process be orphand?

Solution 1
———
Every process has a process, you can’t have an “orphaned” process, though a process can remain in orphaned state for a small moment.

SHELL
=====
Dot Matching
————
* and ? don’t match a filename starts with a dot.
* and ? don’t match the / in a pathname.

Character Class
—————-
[] is a character class.
The expression [a-zA-Z]* matches all filenames beginning with an alphabet, irrespective of case.
*.[!co] – Matches all filenames with a single-character extension but not the .c or .o files.
[!a-zA-Z]* Matches all files names that don’t begin with an alphabetic character.

cp $HOME/prog_sources/*.{c,java} — Copy all files in a directory having extension c or java
cp $HOME/source/{project, html}/* — Copy all files from the directories project and html

Solution 13
————
open a file in vi editor in command mode then follow below commands..
/patn — searches forward for pattern patn. For e.g. to search for pattern “execute” use /execute
?patn — searches backward for pattern patn
n — repeat search in same direction along which previous search was made
N — repeat search in direction opposite to that along which previous search was made

Problem 14
————
how to substitute?

Solution 14
———–
Use below..
:5,10s/x/y/g — Substitute every occurence of “x” by “y” from line 5 to 10
:.s/x/y/g — Substitute every occurence of “x” by “y” in the current line only
:$s/x/y/g — Substitute every occurence of “x” by “y” in the last line

If you need confirmatory substituion then use “c” with “g” like below
:2,$s/x/y/gc

Note: Significance of “g” is to substitute every occurence in a line else first occurence of “x” will be replaced by “y” in every line only.

————————————————Note—————————————————
I am closing Vi Editor here for now. Hope this will help you all. Suggestions and Criticism are cordially welcomed and highly appreciated :-)..Enjoy learning

Basic Vi Editor commands
————————
Problem 1
———
How to do the undo in Vi editor?

Solution 1
———-
Go to command mode and press “u” to undo the last action.

Problem 2
———
How to convert lines into comments?

Solution 2
———
Use “I” and “A”
“I” inserts at the beginning of line.
“A” appends at the end of line.
So press “I” and type /* then [Escape] and then press “A” and type */ then [Escape]. Due to this each line can be converted to comment.

Problem 3
———
How to insert lines above and below the current line without placing the cursor at the start and end of line?

Solution 3
———-
Use “o” and “O”
open a file in command mode and press “o” which inserts a new line below the current line.
Open a file in command mode and press “O” which inserts a new line above the current line.

Problem 4
———
What is the difference between s,S,r,R in command mode?

Solution 4
———
r –> Replaces a single character with one character.
R –> Replaces all text on the right of the cursor position.
s –> Replaces a single character with many.
S –> Replaces the entire line irrespective of cursor position.

Scene 1 — If you are suppossed to search range of values then use clustered index because in range search values will be at consecutive location in sorted order after clustered index creation. So effort for engine would be reduced.

Scene 2 — Use stored procedure instead of individual queries because
– It reduces the network traffic
– Query plan got created once for same query which could be re-used instead of creating again and again.
– Stored procedure can be invoked by passing different parameters instead of sending newly created query again and again.

Performance Tuning – Part 1

﻿﻿2. While writing queries few things must be considered – Use operators =,>,<,>=,<=,like,between.

3. Replace the BETWEEN with >= and <= operators because BETWEEN in turn converted to mentioned oprators. So with we can reduce one step.

4. Don’t use functions in the WHERE clause. For e.g. select col1 from Table1 where upper(col1) = col2 — If we are having index created on columns col1 and col2 then because of function query engine will not use the index in select operation.

5. Similarly don’t use the mathematical expression in WHERE clause. For e.g. select col1 from Table1 where (col1 * 3) = col2

6. One of the most common pitfall is mismatch in datatype on both side of join. for e.g. select col1 from table1 where col1=col2 — if datatype of col1 and col2 are different then it reduces the performance of query.

——————————————————————————
System Procedure
sp_plan_dbccdb – Recommends suitable sizes for new dbccdb and dbccalt
databases, lists suitable devices for dbccdb and dbccalt,
and suggests a cache size and a suitable number of
worker processes for the target database.
sp_plan_dbccdb [dbname]

dbcc Procedure
sp_dbcc_alterws – Changes the size of the specified workspace to a specified
value, and initializes the workspace.
sp_dbcc_alterws dbname, wsname, “wssize[K|M]”

sp_dbcc_configreport – Generates a report that describes the configuration
information used by the dbcc checkstorage operation for the
specified database.
sp_dbcc_configreport [dbname]

sp_dbcc_createws – Creates a workspace of the specified type and size on the
specified segment and database.
sp_dbcc_createws dbname, segname, [wsname], wstype,
“wssize[K|M]”

sp_dbcc_deletedb – Deletes from dbccdb all the information related to the
specified target database.
sp_dbcc_deletedb [dbname]

sp_dbcc_deletehistory – Deletes the results of dbcc checkstorage operations
performed on the target database before the specified date and time.
sp_dbcc_deletehistory [cutoffdate [, dbname]]

sp_dbcc_differentialreport – Generates a report that highlights the changes
in I/O statistics and faults that took place between two dbcc
operations.
sp_dbcc_differentialreport [dbname [, objectname]],
[db_op] [, “date1” [, “date2”]]

sp_dbcc_evaluatedb – Recomputes configuration information for the target
database and compares it to the current configuration information.
sp_dbcc_evaluatedb [dbname]

Subscribe Us

Leave Blank:Do Not Change:

Your email:

Worldwide Visitors

Contributors

Anurag has more than 6+ years of experience in Sybase Database Development .His Area of expertise includes Performance, Query Optimization, Cost Optimization, TSQL Development. He is also involved in Consultancy to Financial Firms for Database Implementation and Maintenance. He has supported many Global Financial firms and recently started a new portal -Mati Rang. AnVa (Founder) has more than 6+ years Exp in Sybase ASE/REP Database Administration. His area of interest is ASE Implemenation and maintenance , Performace Tunning , Sybase HA ,Shared Cluster and Replication. Also exploring the In-Memory Databases (HANA) , Big Data, Hadoop and Java. He is also supporting the Forum Sybase Team and started this sybaseblog.com in late 2009.Andrew is Guest Blogger on sybaseblog.com. Andrew have been working with Sybase for more than a decade: ASE & RS mostly.
He has written lot of tools that help to manage/monitor the system for ASE and Replication and some tools are on the way..
He is also poet and love to be creative all the way.

Admin

Disclaimer

This Blog is neither sponsored by nor in any way affiliated with SAP & Sybase,Inc. In any case, neither any authors nor SAP & Sybase Inc assumes any responsibility for errors in the blog postings, nor do they have any liblilties for damages resulting from the use of blog postings.If you are using any Supported & Unsupported commands/features listed in blog, this is completely on your(user) risk, sybaseblog.com not having any libilitiy.

This blog is only for sharing purpose. The opinions expressed here represent bloggers own and not those of their any past and present employer.