One way to create an Oracle db using Windows:
(I created an 11g db)
- Open DBCA (probably in C:\Oracle\product\11.1.0\db_1\BIN).
- Hit Next.
- Select Create a Database and hit Next.
- Select General Purpose or Transaction Processing and hit Next.
- Enter a Global Database Name (use this as your SID) and hit Next.
- Unselect Configure Enterprise Manager and hit Next.
- Select Use the Same Administrative Password for All Accounts and enter ‘password’ in each box. Click Next.
- Click Finish.
- Click OK on the box that pops up.
- After the database creates successfully, exit DBCA.
After creating the database, I needed to import a dump file. So first I had to set up the import directory, and some tablespaces and roles needed for the import.
In this example, 'C:\tmp' is my import directory, where the dump file is located:
CREATE OR REPLACE DIRECTORY import_dir AS 'C:\tmp';
COMMIT;
I needed to setup a profile for my db:
CREATE PROFILE APP_PROFILE
LIMIT FAILED_LOGIN_ATTEMPTS 10
PASSWORD_LIFE_TIME 180
PASSWORD_LOCK_TIME 1
PASSWORD_GRACE_TIME 7;
COMMIT;
Examples of setting up tablespaces and roles:
CREATE TABLESPACE TABLE_INDEX01 DATAFILE 'C:\Oracle\oradata\[insert SID here]\table_index01.dbf' SIZE 1000m AUTOEXTEND ON MAXSIZE 2000m EXTENT MANAGEMENT LOCAL UNIFORM SIZE 5m;
COMMIT;
CREATE ROLE TEST_DBA IDENTIFIED BY TEST_DBA;
COMMIT;
Then I ran the following command to import the dump file:
%ORACLE_HOME%\bin\impdp system/password full=y directory=import_dir dumpfile=name_of_dump_file.dmp nologfile=Y
You can use the DBCA tool to delete databases also.
When I tried to connect to my new database in SQL Developer, I ran into some errors. You need to make sure your Listener is running before you can connect. At a command prompt:
> LSNRCTL
> status
If you receive an error, start the listener:
> start