db

install phpMyAdmin

wget http://installit.googlecode.com/hg/install.phpMyAdmin.sh -O - | bash -

#!/bin/bash

URL=http://netcologne.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.4.5/phpMyAdmin-3.4.5-english.tar.bz2

# set variables
FILE=${URL##*/}

# set target
if [ ! -z $1 ]; then
  TARGET=$1
else
  TARGET=/var/www
fi

# set owner
if [ ! -z $2 ]; then
  WWW_USER=$2
else
  WWW_USER=www-data
fi

# download if not already exists
[ ! -f /tmp/${FILE} ] && wget -nv ${URL} -O /tmp/${FILE}

# backup old phpmyadmin installation
[ -d ${TARGET}/phpMyAdmin/ ] && mv ${TARGET}/phpMyAdmin/ ${TARGET}/phpMyAdmin.backup.$(date "+%F_%T")

# extract
tar -xjf /tmp/${FILE} -C ${TARGET}

# rename directory to simply "phpMyAdmin"
mv ${TARGET}/phpMyAdmin-*/ ${TARGET}/phpMyAdmin/

# change owner
chown ${WWW_USER}:${WWW_USER} -R ${TARGET}/phpMyAdmin/

Configure
cp config.sample.inc.php config.inc.php
edit config.inc.php
$cfg['blowfish_secret'] = 'terceS';

# configure user and db
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'YOUR_DB_USER';
$cfg['Servers'][$i]['password'] = 'YOUR_DB_PASS';
$cfg['Servers'][$i]['host'] = 'YOUR_DB_HOST';

# optionaly you can restrict whitch databases should by showed in phpMyAdmin
$cfg['Servers'][$i]['only_db'] = 'YOUR_DB_NAME';

OPTIONAL

# enable SSL encryption
cat <<EOF>> ${TARGET}/.htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
EOF

# restrict access
cat <<EOF>> ${TARGET}/.htaccess
AuthName "Authorized Users Only."
AuthType Basic
AuthUserFile /etc/apache2/htpasswd
Require user YOUR_USER
EOF

# create password file
touch /etc/apache2/htpasswd
htpasswd /etc/apache2/htpasswd YOUR_USER

# restart apache
/etc/init.d/apache2 restart

Oracle queries

-- select a random row from table
SELECT column FROM 
   SELECT column FROM TABLE
   ORDER BY DBMS_RANDOM.VALUE
)
WHERE ROWNUM = 1
 
-- update materialized view
BEGIN
   dbms_snapshot.refresh('SCHEMA.MATERIALIZED_VIEW_NAME'); 
END;
 
-- view scheduler jobs
SELECT * FROM user_scheduler_jobs
 
-- get lock on table (NOWAIT)
SELECT username,v$lock.sid,TRUNC(id1/POWER(2,16)) rbs,BITAND(id1,TO_NUMBER('ffff','xxxx'))+0 slot,id2 seq,lmode,request
FROM v$lock, v$session
WHERE v$lock.TYPE = 'TX'
AND v$lock.sid = v$session.sid
 
-- set password
ALTER USER hr identified BY test

Create XEN Oracle 10 XE Domain

http://www.panticz.de/Install_Oracle_XE
 
 
#!/bin/bash
 
# filename: createXenImageOracle10xe.sh
 
# !!!

Do you like this page? Then support it. Please click the AD below and visit the sponsor. Thank you!


Syndicate content