Home » Open Source » Programming Interfaces » How to create Oracle database using Php code?
icon5.gif  How to create Oracle database using Php code? [message #441399] Sun, 31 January 2010 08:17 Go to next message
gens
Messages: 6
Registered: January 2010
Location: malaysia
Junior Member
Is that possible to create a new Oracle database using PHP code? I know that it is possible to create MySql database using PHP. I'm new to Oracle database. Thanks in advance.
Re: How to create Oracle database using Php code? [message #441401 is a reply to message #441399] Sun, 31 January 2010 08:31 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It is possible ONLY if you are on the database server not via an application server.
And in this case why not using SQL*Plus?

Regards
Michel
icon7.gif  Re: How to create Oracle database using Php code? [message #441422 is a reply to message #441401] Mon, 01 February 2010 01:14 Go to previous messageGo to next message
gens
Messages: 6
Registered: January 2010
Location: malaysia
Junior Member
Thanks for reply!

I'm MySql + PHP developer for many years. Recently I just trying Oracle db. I have a MySql utility (PHP class) that performs common tasks like CREATE, DROP, ALTER MySql db (for remote servers). I just try to do that for Oracle db.
Re: How to create Oracle database using Php code? [message #441424 is a reply to message #441422] Mon, 01 February 2010 01:41 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Is MySQL database the same as Oracle schema or is this a real database containing multiple schemas?

You may have a look at Database Concepts to be sure we have the same vocabulary.

Regards
Michel
Re: How to create Oracle database using Php code? [message #441427 is a reply to message #441399] Mon, 01 February 2010 02:00 Go to previous messageGo to next message
gens
Messages: 6
Registered: January 2010
Location: malaysia
Junior Member
Oh, I just stated my intention and I understand your reply.

But Donald K. Burleson (the book author of "Oracle Tuning: The Definitive Reference") said it is possible.
Re: How to create Oracle database using Php code? [message #441430 is a reply to message #441399] Mon, 01 February 2010 02:03 Go to previous messageGo to next message
gens
Messages: 6
Registered: January 2010
Location: malaysia
Junior Member
Please take a look at http://dbaforums.org/oracle/index.php?showtopic=19196

Do you believe that he just try to trick me into buying his recommended book?
Re: How to create Oracle database using Php code? [message #441433 is a reply to message #441430] Mon, 01 February 2010 02:12 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Do you believe that he just try to trick me into buying his recommended book?

For sure!

As I said, you can do it in PHP but not through an application server, directly calling PHP on database server command line.

Regards
Michel

[Updated on: Mon, 01 February 2010 02:14]

Report message to a moderator

Re: How to create Oracle database using Php code? [message #441561 is a reply to message #441422] Mon, 01 February 2010 23:03 Go to previous messageGo to next message
oratab
Messages: 5
Registered: April 2008
Location: Atlanta and/or Kansas Cit...
Junior Member
I have been an Oracle DBA for several years, supporting many
different environments + applications... I am not a PHP coder.
( so, take this answer in context )

I would think that if PHP can connect to Oracle and execute dynamic SQL+DDL on the database, ans uses a DB-Session that has proper Oracle-DB permissions... that you should be able to do all those things, and more.

HOWEVER, I would also suggest that it is easier to create SQL scripts/files that contain all of the CREATE statements, and run them directly with Oracle's 'sqlplus" script tool, rather than try to get each SQL statement to run separately via PHP.

Besides, there are several more things that you need to setup, rather than just tables,indexes, and data. You should create a separate UserID+Schema to own the tables, which is NOT the SYSTEM/DBA account. You need to create tablespace storage areas, to properly use disk space, and give you better control of storage, so you are NOT creating application tables in the SYSTEM tablespace storage (and making a cluttered mess). Preferably, you will want to have your indexes and data stored in separate tablespaces, on different drives... unless you database is really small -or- your server is very large and using SAN storage.

THEN, after you have organized your user permissions, and storage areas, you can create the tables & such, using sqlplus.

NOW you are ready to start having your web/PHP application start working with the tables & database contents, to read/write data(select/insert/update) using the pre-defined structures in your Oracle database.

SO, my answer is "Yea, you could do that..." but why make it harder than it needs to be? Run the SQL directly from the DB-sserver, with sqlplus to get the structure/DB-objects and base data setup. Only after that, let your PHP work with the data.

Re: How to create Oracle database using Php code? [message #441565 is a reply to message #441561] Mon, 01 February 2010 23:33 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
SO, my answer is "Yea, you could do that..."

Are you sure you can create a database with PHO through an application server?

Regards
Michel
Re: How to create Oracle database using Php code? [message #441685 is a reply to message #441399] Tue, 02 February 2010 11:24 Go to previous messageGo to next message
gens
Messages: 6
Registered: January 2010
Location: malaysia
Junior Member
hi oratab,

I'm so confusing here Shocked . Some said it is possible. Some said otherwise.

For sake of education for all, can you prepare a real example using PHP?
Re: How to create Oracle database using Php code? [message #441689 is a reply to message #441685] Tue, 02 February 2010 11:40 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
I'm so confusing here . Some said it is possible. Some said otherwise

You have for what you pay, forum is free, answers are free.

Quote:
can you prepare a real example using PHP?

can YOU prepare a real example using PHP? It is your problem if the forum can't answer you, you have to do it by yourself.

Anyway, Oracle is not MySQL, you don't create a database on the fly.

Regards
Michel

[Updated on: Tue, 02 February 2010 11:41]

Report message to a moderator

Re: How to create Oracle database using Php code? [message #441695 is a reply to message #441399] Tue, 02 February 2010 12:54 Go to previous messageGo to next message
gens
Messages: 6
Registered: January 2010
Location: malaysia
Junior Member
Hi Michel,

take it easy my friend Smile , after all our interactions here are just to share knowledge.

I'm not demanding anything, but kindly just ignore my request.

Re: How to create Oracle database using Php code? [message #441700 is a reply to message #441695] Tue, 02 February 2010 15:45 Go to previous message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I take it easy, just pointing to basic facts about forum.
Anything you can read, you have to test it.

Regards
Michel
Previous Topic: ODBC Driver connectivity error
Next Topic: connect to oracle from php: error loading php_oci8.dll
Goto Forum:
  


Current Time: Thu Dec 08 02:38:33 CST 2016

Total time taken to generate the page: 0.17593 seconds