db

warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

mssql

# shrink database (test)
USE Database_Name
select name,recovery_model_desc from sys.databases
ALTER DATABASE Database_Name SET RECOVERY simple
DBCC SHRINKFILE (Database_Name_log , 1)

ALTER DATABASE [mydatabase] SET RECOVERY SIMPLE
DBCC SHRINKFILE()
ALTER DATABASE [mydatabase] SET RECOVERY FULL

DBCC SHRINKFILE()
BACKUP LOG WITH TRUNCATE_ONLY
DBCC SHRINKFILE()

ALTER DATABASE mydb1 MODIFY FILE (NAME = mydb1_log, SIZE = 8192);

DBCC SHRINKFILE(mydb1_log, 124400);

Create Oracle 10 XE Xen DomU domain

# download debian 32 bit domU installer 
wget http://ftp.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/xen/initrd.gz -O /tmp/initrd.gz
wget http://ftp.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/xen/vmlinuz -O vmlinuz
 
# create lvm for domU
lvcreate --name oracle-disk --size 16G vg1
lvcreate --name oracle-swap --size 16G vg1
 
# create domU config for installation
cat <<EOF> /etc/xen/oracle 
kernel      = '/tmp/vmlinuz'
ramdisk     = '/tmp/initrd.gz'
vcpus       = '2'
memory      = '2048'
root        = '/dev/xvda2 ro'
di

install phpMyAdmin

Check for current version
www.phpmyadmin.net

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.phpMyAdmin.sh -O - | bash -

#!/bin/bash

if [[ $(dpkg-query -W -f='${Version}' mysql-server) =~ 5.5 ]]; then
  # current version compatible with PHP 5.3 and MySQL 5.5
  URL=https://files.phpmyadmin.net/phpMyAdmin/4.6.2/phpMyAdmin-4.6.2-all-languages.zip
else
  # older version compatible with PHP 5.2 and MySQL 5
  URL=http://switch.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.10/phpMyAdmin-4.0.10-english.tar.bz2
fi

# 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/

# todo, import tables
mysql --host=localhost --user=${DB_USER} --password=${DB_PASS} ${DB_NAME} [geshifilter- /var/www/phpMyAdmin/sql/create_tables.sql

Oracle queries

-- output parameter
SET wrap off;
SET pagesize 0;
SET linesize 120;
column owner format a30;
 
-- show configuration
show parameters;
 
-- list users
SELECT username FROM all_users 
 
-- find constraint
SELECT *
FROM all_constraints
WHERE constraint_name = 'SYS_C00381400';
 
-- 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

Oracle

Links

ORACLE Free and Open Source Software
http://oss.oracle.com/

Oracle Database 10g Express Edition
http://oss.oracle.com/oracle-database-xe.html

Oracle SQL Developer
http://oss.oracle.com/sqldeveloper.html

Backup
https://oracle-base.com/articles/11g/data-pump-enhancements-11gr1
su oracle -

$ crontab -l
MAILTO=foo@example.com
ORACLE_HOME=/oracle/app/product/11.2.0/dbhome_1

Syndicate content