Formatting code for OracleDatabase
{{parent page="Oracle"}}
===Oracle timezone changes===
%%
srvctl setenv database -d SID -t TZ=Australia/Sydney
%%
=== Create database ===
Creating database should be done with care. Some of the parameters like character set cannot be altered once the database is created. The following example creates a database named 'ora10' with UTF support.
%%
create database ora10
logfile group 1 ('D:\oracle\databases\ora10\redo1.log') size 10M,
group 2 ('D:\oracle\databases\ora10\redo2.log') size 10M,
group 3 ('D:\oracle\databases\ora10\redo3.log') size 10M
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
datafile 'D:\oracle\databases\ora10\system.dbf'
size 50M
autoextend on
next 10M maxsize unlimited
extent management local
sysaux datafile 'D:\oracle\databases\ora10\sysaux.dbf'
size 10M
autoextend on
next 10M
maxsize unlimited
undo tablespace undo
datafile 'D:\oracle\databases\ora10\undo.dbf'
size 10M
default temporary tablespace temp
tempfile 'D:\oracle\databases\ora10\temp.dbf'
size 10M;
%%
If the database is in English only, change the following parameters.
%%
character set WE8ISO8859P1
national character set utf8
%%
When the database is created, catalog it.
%%
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
%%
== Query a database's character set setting ==
%%
select value$ from sys.props$ where name = 'NLS_CHARACTERSET';
%%
==Query database's process limit==
%%
show parameters PROCESS
%%
==Enable archivelog mode==
%%
SQL> shutdown immediate;
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> archive log list;
%%
Then archive logs are automatically stored in DB_RECOVERY_FILE_DEST. One can check where that is by
%%
SQL> show parameters DB_RECOVERY_FILE_DEST;
%%
Which is the $ORACLE_HOME/flash_recovery_area
To immediate archive redo logs
%%
SQL> alter system switch logfile;
SQL> select group#,status,archive from v$log;
SQL> select name from v$archived_log;
%%
===Oracle timezone changes===
%%
srvctl setenv database -d SID -t TZ=Australia/Sydney
%%
=== Create database ===
Creating database should be done with care. Some of the parameters like character set cannot be altered once the database is created. The following example creates a database named 'ora10' with UTF support.
%%
create database ora10
logfile group 1 ('D:\oracle\databases\ora10\redo1.log') size 10M,
group 2 ('D:\oracle\databases\ora10\redo2.log') size 10M,
group 3 ('D:\oracle\databases\ora10\redo3.log') size 10M
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
datafile 'D:\oracle\databases\ora10\system.dbf'
size 50M
autoextend on
next 10M maxsize unlimited
extent management local
sysaux datafile 'D:\oracle\databases\ora10\sysaux.dbf'
size 10M
autoextend on
next 10M
maxsize unlimited
undo tablespace undo
datafile 'D:\oracle\databases\ora10\undo.dbf'
size 10M
default temporary tablespace temp
tempfile 'D:\oracle\databases\ora10\temp.dbf'
size 10M;
%%
If the database is in English only, change the following parameters.
%%
character set WE8ISO8859P1
national character set utf8
%%
When the database is created, catalog it.
%%
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
%%
== Query a database's character set setting ==
%%
select value$ from sys.props$ where name = 'NLS_CHARACTERSET';
%%
==Query database's process limit==
%%
show parameters PROCESS
%%
==Enable archivelog mode==
%%
SQL> shutdown immediate;
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> archive log list;
%%
Then archive logs are automatically stored in DB_RECOVERY_FILE_DEST. One can check where that is by
%%
SQL> show parameters DB_RECOVERY_FILE_DEST;
%%
Which is the $ORACLE_HOME/flash_recovery_area
To immediate archive redo logs
%%
SQL> alter system switch logfile;
SQL> select group#,status,archive from v$log;
SQL> select name from v$archived_log;
%%