Register now and start sharing your code snippets.
-->

How to export and import Oracle schemas, or backup Oracle databases

Shell Script (Bash) posted 10 months ago by christian

You can use the exp and imp executables to perform data backup and restoration.

   1  -- Export
   2  exp <username>/<password>@<server> file=data.dmp consistent=y grants=no statistics=none
   3  
   4  -- Import
   5  imp <username>/<password>@<server> file=data.dmp fromuser=<source_username> touser=<username>

Tagged import, export, oracle, dump, backup

Fixing slowdown of X after installing 4Gb of RAM

Shell Script (Bash) posted 10 months ago by marko

Both X and 3D acceleration of my Lenovo X61s became horrendously slow after I upgraded to 4Gb of RAM . After a while of Googling I found a thread that explained why it had become slow. In my dmesg I could see the following error, which hinted me to the cause.

   1  mtrr: type mismatch for e0000000,10000000 old: write-back new: write-combining

I want to emphasize that I’m not the author of this script. But I want to store it here because forums and topics sometimes disappear. The original author seems to be “hubick” of the thread linked above. For me this script was plug & play, so many props to the original author if you happen to read this ;) I just needed to run it before X was started.

   1  #!/bin/sh
   2  # Fixup /proc/mtrr
   3  #
   4  # chkconfig: 12345 0 99
   5  # description: Fixup /proc/mtrr
   6  #
   7  # Save this file as /etc/init.d/mtrrfixup and
   8  # use "chkconfig --add mtrrfixup"
   9  # to have this script run by init when the system starts.
  10  #
  11  # The default mtrr table after boot looks like the following:
  12  # reg00: base=0xd8000000 (3456MB), size= 128MB: uncachable, count=1
  13  # reg01: base=0xe0000000 (3584MB), size= 512MB: uncachable, count=1
  14  # reg02: base=0x00000000 (   0MB), size=4096MB: write-back, count=1
  15  # reg03: base=0x100000000 (4096MB), size= 512MB: write-back, count=1
  16  # reg04: base=0x120000000 (4608MB), size= 128MB: write-back, count=1
  17  # reg05: base=0xd7f80000 (3455MB), size= 512KB: uncachable, count=1
  18  #
  19  # The main problem is entry 1, which covers
  20  # the AGP aperature and Video Card memory.
  21  # Being present and uncachable, it prevents
  22  # the fglrx driver module from using/creating a
  23  # write-combined region for the video card.
  24  # The second problem is entry 2, covering all
  25  # our ram, which prevents us from creating
  26  # any new sections which aren't uncachable.
  27  #
  28  # We have a maximum of 7 mtrr registers.
  29  # All sizes must be a power of two.
  30  # The start and end of any page must
  31  # have the same 'upper bits'.
  32  
  33  # First remove all existing values...
  34  # Order matters - wrong order locks system hard!
  35  echo "disable=2" >| /proc/mtrr
  36  echo "disable=5" >| /proc/mtrr
  37  echo "disable=1" >| /proc/mtrr
  38  echo "disable=3" >| /proc/mtrr
  39  echo "disable=4" >| /proc/mtrr
  40  echo "disable=0" >| /proc/mtrr
  41  
  42  # Now create the right ones...
  43  
  44  # Main Memory: 0-2048,2048-3072,3072-3328,3328-3456
  45  # These are powers of two, they get progressively smaller
  46  # so we can get right up to the system device page below.
  47  echo "base=0x00000000 size=0x80000000 type=write-back" >| /proc/mtrr
  48  echo "base=0x80000000 size=0x40000000 type=write-back" >| /proc/mtrr
  49  echo "base=0xC0000000 size=0x10000000 type=write-back" >| /proc/mtrr
  50  echo "base=0xD0000000 size=0x08000000 type=write-back" >| /proc/mtrr
  51  
  52  # System Devices: 3456-3584
  53  echo "base=0xD8000000 size=0x08000000 type=uncachable" >| /proc/mtrr
  54  
  55  # AGP Aperature: 3584-3712
  56  echo "base=0xE0000000 size=0x08000000 type=write-combining" >| /proc/mtrr
  57  
  58  # Video Card: 3712-3840
  59  echo "base=0xE8000000 size=0x08000000 type=write-combining" >| /proc/mtrr
  60  
  61  # High memory area: 4096-5096
  62  echo "base=0x100000000 size=0x40000000 type=write-back" >| /proc/mtrr

Tagged mtrr, large memory, slowdown, x, 3d, fglrx

Disable javascript resizing of Firefox

Shell Script (Bash) posted 10 months ago by marko

There is absolutely not a single developer in the world who knows what size I like my browser, although many people think they do. To prevent resizing of FF make the following steps.

  1. Open browser preferences
  2. Choose “Content”
  3. Choose “Advanced” on the “Enable javascript” preference
  4. Untick “Move or resize existing windows”

Tagged resize, firefox, browser, koon muuttaminen, javascript, fönstrets dimensioner

Limiting scp bandwidth usage

Shell Script (Bash) posted 10 months ago by marko

Use the -l parameter of scp to limit the speed of a file transfer (both upload or download). An empirically tested, good value for a 54Mbit wireless connection is 18000:

   1  scp -l 18000 remotehost:file.img .

Tagged scp, limit bandwidth, kaistan rajaaminen, begränsad bandbredd

SSH public key encryption - How to generate the key and how to copy it to the remote machine

Shell Script (Bash) posted 10 months ago by christian

   1  ssh-keygen -t dsa
   2  ssh-copy-id -i ~/.ssh/id_dsa.pub user@server

OS X doesn’t come equipped with ssh-copy-id but you can download the script from here.

Tagged ssh, public key, login, generate