Professional Documents
Culture Documents
Rajat1205sharma Wordpress Com Category Linux For Dbas
Rajat1205sharma Wordpress Com Category Linux For Dbas
https://rajat1205sharma.wordpress.com/2015/02/27/how-to-kill-semaphore-of-
oracle-instance-remove-shared-memory-of-oracle-instnace/
Sometimes situation arise when we try to start our db and we get error like not
suf cient memory available, so unable to start our database. so one other option
that we have is if there are no other DB on the host machine and if it is a Linux
OS, then you can use the below command to clear the RAM without restarting the
server machine –
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
“sync; echo 1 > /proc/sys/vm/drop_caches”
Rajat DBA'S Blog Blog at WordPress.com.
The above command can be used in Production servers to clear RAM without
restarting the macine.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Advertisements
By rajat sharma in Linux for DBA's, Uncategorized | March 12, 2016 | 125 Words | Leave a comment
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
In production environment we have to maintain trace les of past 15/30/45 days
Rajat DBA'S Blog Blog at WordPress.com.
then instead of deleting that le you might wanna truncate the le and retain only
latest ‘N’ number of lines. one good way to do this is by using ‘SED’ utility.
for example:
oracle@accord:/n01/ora ash1> ls
logsweep_ora_201603.log
oracle@accord:/n01/ora ash1> du -sh *
445M logsweep_ora_201603.log
oracle@accord:/n01/ora ash1> sed -i -e :a -e ‘$q;N;8000,$D;ba’
logsweep_ora_201603.log
oracle@accord:/n01/ora ash1> du -sh logsweep_ora_201603.log
804K logsweep_ora_201603.log
By rajat sharma in Linux for DBA's, Uncategorized | March 12, 2016 | 114 Words | Leave a comment
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
How to delete user account in
Rajat DBA'S Blog Blog at WordPress.com.
Redhat/Ubuntu Linux?
1 Vote
userdel username
Example:
userdel surendra
The disadvantage of the above command is that it only deletes users login details
but not his home directory.
Example2: Deleting user account and his home directory from a Linux machine
userdel -r username
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
The disadvantage of above two commands are that they will not delete user les
Rajat DBA'S Blog Blog at WordPress.com.
which are scattered across the machine such as his personal les, his mail spool
etc.
There is an excellent user deleting command with more options such as deleting
entire user les, the command is deluser. We will see some examples of this
command
Example5: Delete user account along with his home directory and his personal
les which are located in different locations which you are not aware.
Example6: Delete user account and take backup of his les to a directory for future
use by the company.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Example: I want to delete user account Don and take backup of all his les to
Rajat DBA'S Blog Blog at WordPress.com.
/var/backup
By rajat sharma in Linux for DBA's | August 3, 2015 | 225 Words | Leave a comment
export, set and setenv commands are used in UNIX for setting value of a variable
or an environment variable. In order to understand the difference between the set,
setenv and export UNIX commands, the user should know the difference between a
normal variable and an environment variable.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Let us consider an example. In k-shell or bourne shell, a variable is de ned as
Rajat DBA'S Blog Blog at WordPress.com.
shown below:
# FILE=”output.txt”
This means the variable FILE is assigned a value ‘output.txt’. This value can be
checked by doing “echo $FILE”. This FILE variable is a normal or local variable.
This assignment makes the scope of this variable only inside the shell in which it
is de ned. Any shell or a process invoked from the original shell will not have the
variable FILE de ned as shown below.
#FILE=”output.txt”
#echo $FILE
output.txt
#ksh
#echo $FILE
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
can be achieved by the export command in ksh/sh as shown below.
Rajat DBA'S Blog Blog at WordPress.com.
#export FILE=”output.txt”
#echo $FILE
output.txt
#ksh
#echo $FILE
output.txt
set and setenv are the c-shell/tc-shell alternatives for setting a local variable and
environment variable respectively. The set command is used for setting local
variable, setenv is uesd for setting an environment variable:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
#set FILE=”output.txt”
Rajat DBA'S Blog Blog at WordPress.com.
#echo $FILE
output.txt
#tcsh
#echo $FILE
#setenv FILE ”output.txt”
#echo $FILE
output.txt
#tcsh
#echo $FILE
output.txt
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Rajat DBA'Ssharma
Blog in Linux for DBA's | May 16, 2015 | 326 Words | Leave a comment Blog at WordPress.com.
By rajat
Kernel parameters are used to con gure the operating system. Typically, when
con guring for Oracle this involves adjustment for memory on the machine and
how it gets allocated.
Or
Or
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Oracle, just like any other Operating System Process requires resources. It is bound
Rajat DBA'S Blog Blog at WordPress.com.
to the system limits impossed by the kernel parameters. Parameters to regulate
the amount of shared memory, the amount of semaphores are important for Oracle
at runtime. If not properly set oracle simply stops working or do in erratically.
The list of kernel parameters to be set can be found at the installation guide of the
speci c platform.
===========================================================
OS kernel parameters
Windows servers for Oracle are relatively simple when compared to UNIX-based
servers. There are only a few major points to cover to ensure that the Windows
server is optimized for an Oracle database. The larger Windows servers (e.g. the
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
UNISYS ES7000 servers) can have up to 32 CPUs and hundreds of gigabytes of
Rajat DBA'S Blog Blog at WordPress.com.
RAM. They can support dozens of Oracle instances, but many third party
applications can hog server resources, causing Oracle performance issues.
In UNIX and Linux, there is much more exibility in con guration and hundreds of
kernel setting that can bene t database performance. Table 14.1 lists some of the
most common kernel parameters that in uence Oracle:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Parameter Set By the
Rajat DBA'S Blog Description Default Value Blog at WordPress.com.
Name DBA
OS Parameters
For details, the OS speci c Oracle installation guide should be consulted for
details. One of the most common problems with Oracle server con guration is
sub-optimal I/O. For example, the most important thing with Linux is enabling
direct I/O on the underlying le system. Without that being enabled, Linux will
cache les both in the system buffer cache and in SGA. That double caching is
unnecessary and will deprive the server of RAM resources. The following section
provides a closer look by outlining some of the important Oracle parameters for
performance.
Swap Space
The amount of swap space available to the system helps to increase both the
number of processes and the amount of memory they can acquire without
exhausting the system’s RAM. Remember that although swap is slower than
RAM, the system is intelligent enough to move data which is less likely to be
needed to swap, thus freeing up more RAM for data in higher demand. In this way,
adding swap, a slower resource, can increase performance.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
If you nd your current swap allocation is lower than the Oracle recommendation,
Rajat DBA'S Blog Blog at WordPress.com.
you need to increase the size of the swap partition or create a new partition on a
different disk.
Semaphores
Semaphores act as ags for shared memory. Semaphores are either set on or off.
When an Oracle process accesses the SGA in shared memory, it checks for a
semaphore for that portion of memory. If it nds a semaphore set on for that
portion of memory, indicating another process is already using that portion, the
process will sleep and check again later. If there is no semaphore set on for that
portion of memory, it sets one on and proceeds with its operation. When it is
done, it switches that semaphore back to off.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
semmns: The total number of semaphores available
Rajat DBA'S Blog Blog at WordPress.com.
semopm: The number of operations which can be made per semaphore call
semmni: The maximum number of shared memory segments available in the
system
The Oracle recommended values is a good starting point for these parameters, but
when running multiple Oracle databases on a system, semmsl and semmns may
need to be increased to accommodate the additional instances.
To change this setting, edit the /etc/sysctl.conf le. If there is already a line for
kernel.sem, edit the values given; otherwise, add a line in the same format as the
output above. The line should look like this:
This line can be added anywhere in the le, but it is best to keep all the changes in
one place within the le. Comments can be added by starting a line with a #
character.
The parameters shmall, shmmax, and shmmni determine how much shared
memory is available for Oracle to use. These parameters are set in memory pages,
not in bytes, so the usable sizes are the value multiplied by the page size, typically
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
4096 bytes. To con rm the page size, use the command getconf -a | grep
Rajat DBA'S Blog Blog at WordPress.com.
PAGE_SIZE.
shmall: The total amount of shared memory (in pages) which can be allocated
on the system
shmmax: The maximum size of a shared memory segment (in pages)
shmmni: The maximum number of shared memory segments available on the
system
Given that the SGA for a database must be kept in shared memory, the value of
shmmax needs to be as big as the largest SGA. The value for shmall needs to be
bigger than the sum of all your databases. The value for shmmni needs to be at
least as high as the number of databases that are intended to be put on the system,
but in practice is generally much higher (Oracle recommends 4096.)
The quick install guide includes directions on checking these parameters. If they
need to be modi ed, they can be set in the /etc/sysctl.conf le with entries like the
following:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Keep in mind that shmall and shmmax are set in 4 KB pages, not in bytes.
Rajat DBA'S Blog Blog at WordPress.com.
A few additional settings are needed for Oracle. These are not directly related to
the system memory, but are included in this section for completeness.
fs. le-max: Controls the total number of les which can be opened at once
ip_local_port_range: This controls the number of network connections which
can be allocated at once. These are unrelated to the network ports on which
incoming connections are made
rmem_default and rmem_max: Represent the default and maximum size of
the network receive buffer
wmem_default and wmem_max: Represent the default and maximum size of
the network send buffer
Under most circumstances, the Oracle recommended values should be used for
these parameters. These can be set in the /etc/sysctl.conf le.
net.core.rmem_default = 262144
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
net.core.rmem_max = 4194304
Rajat DBA'S Blog Blog at WordPress.com.
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
While many of these settings can be changed dynamically, it is best to set them in
the /etc/sysctl.conf le and restart. After restart, con rm that the settings are
working.
By rajat sharma in Linux for DBA's | May 16, 2015 | 1,317 Words | Leave a comment
Hi guys,
remember my post
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
https://rajat1205sharma.wordpress.com/2015/03/16/snap-clone-copy-on-write-
Rajat DBA'S Blog Blog at WordPress.com.
feature/
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
You can nd more information here :- http://btrfs.wiki.kernel.org
Rajat DBA'S Blog Blog at WordPress.com.
Below is some real time requirement , we can understand the need of such
technology
According to http://blog.contractoracle.com/
——————————————————————————————————-
I recently had a customer who wanted to reduce storage costs. They had a 13TB
PROD database, and needed 40 copies of the database to support DEV and TEST
activities, totalling over 500TB.
We did some diagnostics on the databases, and worked out that only about 10% of
data blocks in a clone were ever updated, so deduplicating at lesystem or storage
block level could result in 90% saving. The client was a large conservative bank, so
the preference was to use existing products from large vendors. We evaluated
products from Delphix, NetApp SnapManager for Oracle, and Oracle ZFS
appliance, and ended up choosing the NetApp product due to a combination of
functionality, cost, and in-house skills.
Since then I have been wondering if we could have done it cheaper, and have done
a quick evaluation of the BTRFS lesystem which does allow deduplication at
lesystem level.
BTRFS is a “copy on write” lesystem and is listed as EXPERIMENTAL, so I don’t
think it is ready to use in a PROD environment, but is worth testing to support
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
DEV and TEST environments depending on the cost of downtime.
Rajat DBA'S Blog Blog at WordPress.com.
By rajat sharma in Linux for DBA's | April 16, 2015 | 388 Words | Leave a comment
http://www.oracle.com/technetwork/articles/linux/part2-085179.html
http://www.oracle.com/technetwork/articles/linux/part3-090589.html
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
File Types:
Rajat DBA'S Blog Blog at WordPress.com.
When you see a le, how do you know what type of le it is? The command le
tells you that. For instance:
# le alert_DBA102.log
alert_DBA102.log: ASCII text
The le alert_DBA102.log is an ASCII text le. Let’s see some more examples:
# le initTESTAUX.ora.Z
initTESTAUX.ora.Z: compress'd data 16 bits
This tells you that the le is a compressed le, but how do you know the type of
the le was compressed? One option is to uncompress it and run le against it; but
that would make it virtually impossible. A cleaner option is to use the parameter -
z:
# le -z initTESTAUX.ora.Z
initTESTAUX.ora.Z: ASCII text (compress'd data 16 bits)
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Another quirk is the presence of symbolic links:
Rajat DBA'S Blog Blog at WordPress.com.
# le sp le+ASM.ora.ORIGINAL
sp le+ASM.ora.ORIGINAL: symbolic link to
/u02/app/oracle/admin/DBA102/p le/sp le+ASM.ora.ORIGINAL
This is useful; but what type of le is that is being pointed to? Instead of running
le again, you can use the option -l :
# le -L sp le+ASM.ora.ORIGINAL
sp le+ASM.ora.ORIGINAL: data
This clearly shows that the le is a data le. Note that the sp le is a binary one, as
opposed to init.ora; so the le shows up as data le.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
le -Lz
Rajat DBA'S * | grep ASCII | cut -d":" -f1 | xargs ls -ltr
Blog Blog at WordPress.com.
This command checks the ASCII les, even if they are compressed, and lists them
in chronological order.
Comparing Files
How do you nd out if two les— le1 and le2—are identical? There are several
ways and each approach has its own appeal.
diff . The simplest command is diff , which shows the difference between two les.
Here are the contents of two les:
# cat le1
In le1 only
In le1 and le2
# cat le2
In le1 and le2
In le2 only
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
If you use the diff command, you will be able to see the difference between the
Rajat DBA'S Blog Blog at WordPress.com.
les as shown below:
In the output, a “<” in the rst column indicates that the line exists on the le
mentioned rst,—that is, le1. A “>” in that place indicates that the line exists on
the second le ( le2). The characters 1d0 in the rst line of the output shows what
must be done in sed to operate on the le le1 to make it same as le2.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
If you just want to just know if the les differ, not necessarily how, you can use the
Rajat DBA'S Blog Blog at WordPress.com.
-q option.
Files le3 and le4 are the same so there is no output; in the other case, the fact
that the les differ is reported.
If you are writing a shell script, it might be useful to produce the output in such a
manner that it can be parsed. The -u option does that:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
The output shows contents of both les but suppresses duplicates, the + and –
Rajat DBA'S Blog Blog at WordPress.com.
signs in the rst column indicates the lines in the les. No character in the rst
column indicates presence in both les.
shows the les present in either directories; whether les are present on one of the
directories or both. If it nds a subdirectory in the same name, it does not go down
to see if any individual les differ. Here is an example:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Only in PROPRD: BACKUP3
Only Blog
Rajat DBA'S in PROPRD: BACKUP4 Blog at WordPress.com.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Only in PROPRD: sqlPlusHelp.log
Common
Rajat DBA'S Blog subdirectories: DBA102/udump and PROPRD/udump Blog at WordPress.com.
Note that the common subdirectories are simply reported as such but no
comparison is made. If you want to drill down even further and compare les
under those subdirectories, you should use the following command:
This command recursively goes into each subdirectory to compare the les and
reports the difference between the les of the same names.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
suppose the current Oracle version is 10.2.0.1. The ORACLE_HOME could be
Rajat DBA'S Blog Blog at WordPress.com.
/u01/app/oracle/product/10.2/db1. When the time comes to patch it to 10.2.0.2, I
don’t patch this Oracle Home. Instead, I start a fresh installation on
/u01/app/oracle/product/10.2/db2 and then patch that home. Once it’s ready, I use
the following:
# sqlplus / as sysdba
SQL> shutdown immediate
SQL> exit
# export ORACLE_HOME=/u01/app/oracle/product/10.2/db2
# export PATH=$ORACLE_HOME/bin:$PATH
# sqlplus / as sysdba
SQL> @$ORACLE_HOME/rdbms/admin/catalog
...
and so on.
The purpose of this approach is that the original Oracle Home is not disturbed and
I can easily fall back in case of problems. This also means the database is down and
up again, pretty much immediately. If I installed the patch directly on the Oracle
Home, I would have had to shut the database for a long time—for the entire
duration of the patch application. In addition, if the patch application had failed
due to any reason, I would not have a clean Oracle Home.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Now that I have several Oracle Homes, how can I see what changed? It’s really
Rajat DBA'S Blog Blog at WordPress.com.
simple; I can use:
This tells me the differences between the two Oracle Homes and the differences
between the les of the same name. Some important les like tnsnames.ora,
listener.ora, and sqlnet.ora should not show wide differences, but if they do, then I
need to understand why.
The output comes back as the rst sign of difference. You can use this to identify
where the les might be different. Like diff , cmp has a lot of options, the most
important being the -s option, that merely returns a code:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Some other non-zero number, if the comparison couldn’t be made
Rajat DBA'S Blog Blog at WordPress.com.
Here is an example:
The special variable $? indicates the return code from the last executed command.
In this case it’s 0, meaning the les le1 and le2 are identical.
This property of cmp can prove very useful in shell scripting where you merely
want to check if two les differ in any way, but not necessarily check what the
difference is. Another important use of this command is to compare binary les,
where diff may not be reliable.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Tip for Oracle Users
Rajat DBA'S Blog Blog at WordPress.com.
Recall from a previous tip that when you relink Oracle executables, the older
version is kept prior to being overwritten. So, when you relink, the executable
sqlplus is renamed to “sqlplusO” and the newly compiled sqlplus is placed in the
$ORACLE_HOME/bin. So how do you ensure that the sqlplus that was just created
is any different? Just use:
# ls -l sqlplus*
-rwxr-x--x 1 oracle dba 8851 Aug 4 05:15 sqlplus
-rwxr-x--x 1 oracle dba 8851 Nov 2 2005 sqlplusO
Even though the size is the same in both cases, cmp proved that the two programs
differ.
comm. The command comm is similar to the others but the output comes in three
columns, separated by tabs. Here is an example:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
# comm
Rajat DBA'S Blog le1 le2 Blog at WordPress.com.
This command is useful when you may want to see the contents of a le not in the
other, not just a difference—sort of a MINUS utility in SQL language. The option
-1 suppresses the contents found in rst le:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
reference parameter
Rajat DBA'S Blog Blog at WordPress.com.
chgrp To change group of a le, using the – -
reference parameter
How we can delete the les which are few days(N days) old?
Ans:To save the disk space you might be deleting the old les or backup which are
1 week(2 weeks) old or depending on your Disk Space and other requirement.We
should automate these tasks as a DBA.We can do this as follows:
#remove_ les_back.sh
#Removing 7 days old dump les
nd /u03/DB_BACKUP_TESTDB/expdp_fulldb_backup -mtime +6 -exec rm {} \;
00 21 * * 0 /u03/DB_BACKUP_TESTDB/expdp_fulldb_backup/remove_ les_back.sh
2>&1 >/u05/DB_BACKUP_TESTDB/logs/CRONJOBS_LOGS/TESTDB_BACK_cron.log
Ans:’view’ command can be used to view le in readonly mode.A very good option
to see cronjob le specially because at any this le should not get modi ed by
mistake as all your daily jobs will be scheduled using cronjob.
Eg: view crontab.oracle
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
display).I nd less more useful specially for seeing log les and to nd the errors or
Rajat DBA'S Blog Blog at WordPress.com.
Warnings in the log les.
Speed: First time, rsync replicates the whole content between the source and
destination directories. Next time, rsync transfers only the changed blocks or
bytes to the destination location, which makes the transfer really fast.
Security: rsync allows encryption of data using ssh protocol during transfer.
Less Bandwidth: rsync uses compression and decompression of data block by
block at the sending and receiving end respectively. So the bandwidth used by
rsync will be always less compared to other le transfer protocols.
Privileges: No special privileges are required to install and execute rsync
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Q. Which command is used to schedule job without user intervention and
Rajat DBA'S Blog Blog at WordPress.com.
backend?
Ans: Most of the time you login into remote server via ssh. If you start a shell
script or command and you exit (abort remote connection), the process / command
will get killed. Sometime job or command takes a long time. If you are not sure
when the job will nish, then it is better to leave job running in background. But, if
you log out of the system, the job will be stopped and terminated by your shell.
What do you do to keep job running in the background when process gets SIGHUP?
The answer is simple, use nohup command line-utility which allows to run
command/process or shell script that can continue running in the background
after you log out from a shell:
OR
nohup /path/to/command-name arg1 arg2 &
Where,
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
command-name : is name of shell script or command name. You can pass
Rajat DBA'S Blog Blog at WordPress.com.
argument to command or a shell script.
& : nohup does not automatically put the command it runs in the background; you
must do that explicitly, by ending the command line with an & symbol.
Use jobs -l command to list all jobs:
jobs -l
nohup command examples
OR
$ ssh rajat@server1.oracle.com
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
exit
Rajat DBA'S Blog Blog at WordPress.com.
In this example, I am going to nd all programs and scripts with setuid bit set on,
enter:
exit
By rajat sharma in Linux for DBA's | April 12, 2015 | 2,660 Words | Leave a comment
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD