Programming :: Shell Script Deleting Oracle Backup?
Mar 8, 2010I setup linux script to delete my backups older than few days:
RBRDAN=`date �date=�3 days ago� +%w`
rm /u02/oracle/backup/rman/$RBRDAN/*
But, I got error:
[code]...
I setup linux script to delete my backups older than few days:
RBRDAN=`date �date=�3 days ago� +%w`
rm /u02/oracle/backup/rman/$RBRDAN/*
But, I got error:
[code]...
I am writing shell script for executing oracle procedure. Shell script need to take 3 parameters from one data file rest of the parameters need to pass in command line it self. Total 7 parameters are need to pass for shell script.1st,3rd,5th parameters need to take from dat file and rest of 4 parameters from command line.
Below is one oracle procedure:
EXEC CIM_MGMT_INSTALL.addFlow('$1','1.0','$1','Settings','$2','ECCD2',NULL,1);
$1is 1st and 3rd both places need to pass same parameter.$1,$2 need to take from data file as earlier says.
I have requirement on shell scriptingre scripts for the following:
1) Full backup(application and DB): tar all the files and database and copy them in the backup server
2) Incremental back up of files: backup of all the updated filester the last backup.
3) Restoring of backup files: restore the backup files from the backup server to the application server.
I had copied oracle setup in the root. Now want to delete it. I tried the following commands, but couldn't succeed:
rm -R oracle-xe-univ-10.2.0.1-1.0.i386.rpm
rm: cannot remove `oracle-xe-univ-10.2.0.1-1.0.i386.rpm': No such file or directory
While this file there only in file system.
I would like to develop a shell script that would automatically run a backup program and then shutdown the computers, but I do not know the first thing about script development or even writing scripting.
View 2 Replies View RelatedI have a shell script that need to create some files:
1) backup files of user passed in file ( that will be written by this shell ).
2) temp files that the shell will create and later delete/remove.
This shell script will be used from my local dir ( I am not a super or a sysadmin ). Users of this shell will call this script to run on their local files in their respective directories. When my script runs, it errors with the following:
cp: cannot create regular file `./listfile.txt.backup': Permission denied
/home/myUser/tools/myShellScript: line 12: listfile.txt: Permission denied
for the temp I was able to avoid this error by creating the temp file in the /tmp directory. All I want is for this shell script to run, create/modify/backup files in user's local dirs.
The user dir has the following permission:
drwxr-xr-x testDir
the file that needs to be backed-up has:
-rw-r--r-- listfile.txt.
how can i connect remotly to Oracle Database using shellscript?.is oracle client is require for connect to oracle db remotly?
View 2 Replies View RelatedHow i will use sqlplus in shell script? Can any one provide sample code which explain following:
1. Connect to oracle DB
2. Exceute select * from tablename
3. Release connection to the DB
4. Append output in file everytime when query executes.
I am trying to import .exp file to oracle database. I have written a script for the same, but i am able to run it manually with out any errors , but it failing from cronjob(Even though i am using absolute path every where) Follwoing is the command i am trying to execute from shell.
/opt/ORACLE/product/bin/imp test/test@testdb full=y ignore=y buffer=1000 log=/data01/import_all.log file=/data01/test.exp
I want to create a script to delete user if he has no login shell.
View 4 Replies View Relatedi have oracle installed on Linux i want to schedule a script "backup.sh" to run in oracle user.
oracle@linux1]crontab -e
*/2 * * * * /tmp/backup.sh
this script does not execute by cron.
BUT
oracle@linux1 tmp] ./backup.sh ------executes successfully
I dont know why the script is not being executed by cron
I was working on a shell and got some weird exceptions in my program.Just as a reference, I want to save all that is there on my shell to a text file. I do not just want the command history but also all the results that those commands produced at the shell.Is there some built-in utility to do this? I have kept the shell open for now, so that I can take the backup. Also, I am using xterm and it does not allow selecting all the way upto the top of the shell, so the ultimate way is to take the backup one screen at a time.
View 2 Replies View RelatedI am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.
Code:
if [ $# -eq 0 ] ; then
d=`pwd`
for i in * ; do
if test -d $d/$i ; then
echo "$i:"
code....
The below shell script is mounting a drive and taking tar backup with today's date and sending status of log to particular directory & sending mail automatically,when i run the below shell script iam reciving the below error, i tired to solve but i was not able to solve,can any one help to solve the problem.
SHELL SCRIPT:
#!/bin/bash
mount -t cifs //10.200.1.125/servers/$(hostname) temp -o username=harish,password=ecare2@
[code]...
I'm a new user for oracle,tried to install oracle 10g on redhat linux 5 but gettinh the same error message.response/ runInstaller[oracle2@localhost database_10201]$ sh runInstaller _runInstaller: line 54:/tmp/database_10201/install/.oui: Permission denied_Doany one plz help me how to give full set of permisions to an user in linux to access a folder??
View 2 Replies View RelatedI've AMD64 system with Ubuntu 11.04 installed. It's been rough ride for me to install oracle-xe-universal. I've already spent more than 2 days on this. Still unsuccessful.
1) First I downloaded the packages libaio_0.3.104-1_i386.deb and oracle-xe-universal_10.2.0.1-1.1_i386.deb
2) Then I ran
sudo apt-get install bc (ran fine)
sudo dpkg -i --force-architecture libaio_0.3.104-1_i386.deb (ran fine)
sudo dpkg -i --force-architecture oracle-xe-universal_10.2.0.1-1.1_i386.deb
(gave me dependency error for libc6 (>= 2.3.2), I modified the control file to remove dependency and rebuilt the package) (now worked fine) Oracle xe is now installed. Then I tried to start the DB it started but it's HTTP client never started. So I decided to uninstall the oracle-xe=universal. None of the sudo apt-get remove oracle-xe-universal command's didn't worked for me. So i went for manual uninstallation directions as per oracle link.
I ran the following command-
--Manually uninstalling Oracle 10g--
sudo rm -rf /usr/lib/oracle /etc/oratab /etc/init.d/oracle-xe /etc/sysconfig/oracle-xe /usr/share/doc/oracle_xe /usr/share/doc/oracle_xe_client
Then I again ran the following command to install oracle-xe
sudo dpkg -i --force-architecture oracle-xe-universal_10.2.0.1-1.0_i386.deb
See below what I got as the output-
rocky@ubuntu:~/git/mygit/edas2/libaio$ sudo dpkg -i --force-architecture oracle-xe-universal_10.2.0.1-1.1_i386.deb
dpkg: warning: overriding problem because --force enabled:
package architecture (i386) does not match system (amd64)
[code]....
Even in applications menu I don't see the if oracle has been installed. So i conclude first time installation was ok but somehow http client didn't worked. After manual uninstallation, second installation didn't even loaded/installed the oracle-xe in init.d directory.
Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?
Example:
Code:
>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...
I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.
im working on a mini project which basically use a simple database(Database.txt) which displays its information in this format :apple chiku banana
Code:
#!/bin/bash
Title=
[code]....
I've just installed the Oracle Instant client using this: https://help.ubuntu.com/community/PHPOracle
The phpinfo() show me that oci8 is enable, but when I try to query that database I've got the following message:
PHP Code:
Code:
How to troubleshoot.
I'm having some trouble this morning to send a SQL query to our Oracle DB server in PHP. When I try to pass my value "OF/110246801A01" as variable it tell's me "Warning: oci_bind_by_name(): ORA-01036: illegal variable name/number"
PHP Code:
$ociO ='OF/110246801A01';
$selectAllFieldsFromOf=oci_parse($conn,"SELECT*FROMMFGOPEWHEREMFGNUM_0LIKE':ociOf' ");
oci_bind_by_name($selectAllFieldsFromOf,":ociOf",$ociOf,15);
$resultQuery =oci_execute($selectAllFieldsFromOf);
if(!$resultQuery){
$e = oci_error($selectAllFieldsFromOf);
return trigger_error(htmlentities($e['message'],ENT_QUOTES),E_USER_ERROR);
[Code]....
As part of my job I often have to write queries in Oracle (10g) and I am experienced enough to see where I should be using an index where possible etc. Most of the time I just let the CBO come up with the best plan however sometimes it obviously doesn't!Now, I know in general that full scans of large tables aren't good however I don't fully understand an execution plan - ie, I could not look at a complex piece of code, look at it's plan and say "oh, the reason that is performing badly there is because the SBO has chosen to use nested loops rather than a hash join, so if I hint it then it will run quicker!" - this ultimately is where I'm trying to get to
View 2 Replies View Relatedcreating the below unix script to run in oracle database .I need a script which should do the following things.
1. The script should insert row count of a table from one database(A) into table (AB) in another database(B).
2. The script should update tow count of the similar table and tablespace from database (B) in to a table AB.
3. The script should update the status column of the table AB as: 'Y' if the rowcount of the table@A and rowcount of the table@B matching. or else it should update 'N'
I'm trying to get my program to go through the string typed in by the user and strip it of EVERYTHING but the numbers. I can't place my finger on what I'm missing.
Code:
Code: #include<iostream>
#include<string>
using namespace std ;
int main()
[Code].....
i jst want to delete a host entry from httpd.conf the entry for lal.com should be deleted!!
View 14 Replies View RelatedWhat could be a command to erase from the cursor up to the first non-blank char in vi (or vim)?
View 3 Replies View RelatedHow to connect to remote oracle database using perl?
This is what I tried.
Code:
But I am unable to connect.
Currently, I'm working on personal project. and I'm kinda stuck. What I want to do is that open a file, and edit that file (deleting unwanted characters). The problem arises after I deleted unwanted characters, the file still has the same length of the original one. Let's assume that we have a file with "1234" in it. I deleted "3" ( I overwrite "\0" ) so now when I check the file, it's 124. But when I check the length, the both have the same size as 4
Here is an example source code
int length, length2;
num = open("a.dat", 2)
length = lseek(num, 0, 2); // Initial length
lseek(num, 2, 0); // editing
write(num, "\0", 1);
length2 = lseek(num, 0, 2); // Final length
close(num);
When I print those values those are exactly the same. Length2 should be one less than length, but the both are 4. What's wrong in m code? Am I supposed to use different character rather than "\0"?
I am about to write my first shell script for backing up my server.
These are the steps I have identified so far.
Copy files to be backed up to /srv/backup/ run mysqldump and copy the file to srv/backup/databases run duplicity to backup /srv/backup/* to another folder on my machine
I am writing a bash shell scrip that will be run everyday, and will carry out the three tasks mentioned above.
Note: point 3 (backing up to a local folder) is only a temporary measure - to allow me to understand what I'm doing, since all the tools I am using, are new to me. Once I can backup and restore correctly, I will use duplicity to compress and encrypt the files and upload them offsite.
If my understanding of duplicity is correct (according to the documentation here), the first time I run the script, a FULL backup will be done. Every subsequent backup will then be incremental. I will then force a FULL back on say a weekend.
First things first though - I have a few questions:
I would like to use backup rotation for the 'scheme' described above - I would like some recommendations on what kind/type of rotation to use. Once I have implemented the backup rotation, how can I restore from a particular day back in time (assuming the backup exists of course). ?
I am running Ubuntu 10.0.4
I have a problem need help, I want to do a schedule with using shell script with crontab in linux SuSE SLES 10.
1. I have many server that want to do backup mysql all from that server everyday. I need advice for for write shell script to backup all mysql in different server to server backup everyday and create auto folder as date example 27102009, 28102009..........for a month will has 30 folder in server backup.
2. Also need to write shell script to delete all folder but keep only one week last example from 1 to 30 it will has 30 folder in sever backup but i want to keep only 7 folder last and want to set schedule delete it every saturday night.
3. used that shell script with crontab in linux.
I have a file which contains milion of records. It contains 12 columns seperated by "||" (delimeter).
First two fields contain first name and last name of a person. Now my requirement is to delete all those records from this file for which:
First two fields does not contain any alphabet.
For e.g i have below mentioned records in file:
gaurav||gandhi||123||456||789
#a%bcd||123abc||89|90||91
12345||@@@||89||123||234
***||!!!!||98||76||90
Now, last two lines should be removed from this file since first two fields does not contain any alphabet for these two records.