Saturday, August 22, 2009

Oracle Database : Complete Export and Import


Suppose, we need to export all the Oracle schema in one step, similar
to "--all-databases" option in MySQL. In such cases, here is how its done:
exp USERID=system/password@sid file=complete_bak.dmp log=/tmp/full.log FULL=Y;
This should export all the databases in one step and will store that to a single file.

Now to import that back, here is what needs to be done.
imp system/password@sid file=complete_bak.dmp log=/tmp/full.log full=y ignore=y
Note:

* Will work only if ORACLE_HOME is same on both servers
* Create tablespace on the new server before importing the database. Else this wont work.

OpenOffice Error : The user interface language cannot be determined-Linux


Stuck at this error after re-installing or upgrading OpenOffice?

OpenOffice Error : The user interface language cannot be determined-Linux

The error occurs because the folder where the necessary files are
not present are not having enough permissions. The solution
is pretty simple. Get into the user's home directory
# cd /home/username
Find the hidden folder which stores OpenOffice files. Its
usually ".openofficeversion" or ".oooversion".
# cd ~/.oooversion
Now execute the below command:
# sudo chown --reference=. -R .openoffice.org2
Now give necessary permissions to that folder:
# sudo chmod -R 755 .openoffice.org2
Try opening up OpenOffice. It should work just fine now.

Bulk downoading files from a webserver folder accessible via FTP


Suppose, if we need to download all files from a web folder, accessible via FTP, we can use LFTP command to do that. For example, in one website, under the "clamav" folder, I need to download all RPM files from there. So instead of downloading that one by one, I can do so by the command below:
lftp -c 'open -e "mget -d *.el5.rf.i386.rpm" http://packages.sw.be/clamav/'
This needs to be executed from a terminal. Also packages, LFTP and MGET needs to be present.

Tuesday, December 16, 2008

Burn an ISO image to a CD right from the command line!


This is commonly used by system administrators who love simple, efficient and verbose method of writing an image into a Compact Disk. If you have an ISO file "image.iso", then you can use the "cdrecord" command:
cdrecord -v speed=8 dev=/dev/cdrom /path/to/image.iso
Attributes:

-v : Verbose mode, shows a lotta information while writing the disk.. geeky :-D
speed = : you can set the burning speed. 8 means 8x speed
-multi : multisession mode (ooooh, cool feature for a command line tool)

Listing files in Linux sorted according to size


Have you ever felt the need to list the 10 files that takes the largest space in a specific directory? You might know that its pretty easy do that via GUI but believe me its the same thing when it comes to the Console also.

Here is how its done:
du -a (directory) | sort -n -r | head -n 10
This will list all the files in the directory specified, sorts them and lists the 10 files that takes up maximum size.

Easy, right?

Tuesday, December 2, 2008

Make files in your webserver download instead of being displayed


Suppose, you have a text file in your web directory. When you access that file, it will be displayed in the web browser itself. If you want to make that file (or any other file type you want) to be asked to download instead of being displayed, here is what you can do:

Create a .htaccess file in that directory with the following content:
AddType unknown/nothing pdf
AddType unknown/nothing txt
AddType unknown/nothing jpg
Now when you access any file with an extension .jpg or .pdf, your browser will ask you to download the file instead of showing up.

Relaying email from Postfix via another SMTP Server


Have you ever been in a situation where you want to relay your emails from your Postfix server via another SMTP server? This is certainly possible and its way too simple:

First thing to do is configure Postfix in your machine. Once done, edit the configuration file for Postfix (usually under /etc/main.cf) and editing the below value:

#relayhost =

to

relayhost = smtp.emailprovider.com

Once done, all emails sent via your Postfix server will be relayed through the desired Outgoing server.

Other options that may interest you are as follows:
  • myhostname = hostname.emailprovider.com
  • mydomain = emailprovider.com
  • masquerade_domains = emailprovider.com
The last option will correct the envelopes shows as "user@emailprovider.com".

Hope that helps someone :-)
 

A Linux Admin's WeBlog! Blak Magik is Designed by productive dreams for smashing magazine Bloggerized by Ipiet The Blog Full of Games © 2008