Home > Default > Beginners question about creating first database and tables

Beginners question about creating first database and tables

November 30Hits:0
Advertisement
Hi all,
i recently have installed 10g express edition, because i want to transform my php-script from mysql to oracle database. (due to the fact that mysql is "not allowed sofware" at the company i work for).
it is a quit small script, just a shift-report system, build because of frustration about an used shift report system based on excel sheets. Company likes it, but IT-department rejected it, because it is myssql. They do own a lot of oracle servers, so they set up a database for me, got a username and password.(Tnsnames entry). The rest i have to do by myself, no further support from IT department.
I have made 2 simple php functions to connect to database:
// for connection home server:
function conn()
     $user = 'user';
     $password = 'password';
     $conn = oci_connect($user, $password, 'localhost/XE');
     return $conn;
// for connection at work:
function Xconn()
     $db = '(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = xxx.eu.xxx.com)(PORT = 1521))
    (CONNECT_DATA = (SID = NVGPP)))';
     $user = 'xxxxxxxx';
     $password = 'xxxxxxx';
     $conn = oci_connect($user, $password, $db);
     return $conn;
}I just add or remove X character before function name, for use at home or at work.
both do work fine.
First thing i wanted to do, is to create my database and tables.
Schema dump from mysql:
-- phpMyAdmin SQL Dump
-- version 2.11.1
-- http://www.phpmyadmin.net
-- Host: localhost
-- Generatie Tijd: 03 Aug 2010 om 21:35
-- Server versie: 5.0.24
-- PHP Versie: 5.2.4
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- Database: `ewb`
-- Tabel structuur voor tabel `afsprakenblad`
CREATE TABLE IF NOT EXISTS `afsprakenblad` (
  `id` mediumint(8) unsigned NOT NULL auto_increment,
  `naam` tinytext NOT NULL,
  `afspraak` text NOT NULL,
  KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COMMENT='Afsprakenblad' AUTO_INCREMENT=13 ;
-- Tabel structuur voor tabel `verslag`
CREATE TABLE IF NOT EXISTS `verslag` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `ewb_id` int(10) unsigned NOT NULL,
  `datum` date NOT NULL,
  `dienst` tinytext NOT NULL,
  `ploeg` tinytext NOT NULL,
  `gebouw` varchar(10) NOT NULL,
  `installatie` tinytext NOT NULL,
  `subdeel` tinytext NOT NULL,
  `subsubdeel` tinytext NOT NULL,
  `sap` int(4) unsigned NOT NULL,
  `tekst` text NOT NULL,
  `status` tinyint(3) unsigned NOT NULL,
  `afdeling` tinytext NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4663 ;
-- Tabel structuur voor tabel `wachtverslag`
CREATE TABLE IF NOT EXISTS `wachtverslag` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `datum` date NOT NULL,
  `dienst` tinytext NOT NULL,
  `team` tinytext NOT NULL,
  `afdeling` tinytext NOT NULL,
  `status` enum('open','dicht') NOT NULL default 'open',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=800 ;When i wanted to create a new databse with: CREATE TABLE ewb, i get an error that databse already is mounted??
How do i create this database and tables?
after googling i read something about schema owners, but cant find anything about how to copy my mysql database/tables to oracle.
Please, help is really appreciated by me.

Answers

Translating from mysql to Oracle will need a bit of fixups for the DDL, once an oracle instance is created, set up and running, you won't create a database but you will have a database user or users that create/own a collection of tables, indexes, functions, procedures, etc.
It will take a bit of pouring through the oracle documentation to get those table create statements to work, i.e. the engine=, charset=, auto_increment items won't succeed, datatypes need adjustments, the tic marks around the entity names aren't necessary, quite a few other items from the mysql data definition language don't have an oracle equivalent.

Read other 2 answers

Tags:

Related Articles

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.774 s.