> Note : For Oracle users this quick start page applies to release 0.0.4 and later.
> Note : For Mysql users this quick start page applies to release 1.0.1 and later.
NoOra is a Python tool, so you must have Python installed in order to proceed.
First, Download and follow the installation instructions. After that, type the following in a terminal or in a command prompt:
> noora.py -r
It should print out your installed version of NoOra, for example:
> noora version '1.0.1'
> noora runtime (build 1.0.1_337)
On your command line, perform the following:
> mynoora generate -pr=example -h=localhost -d=orcl -u=apps -p=apps -v=1.0.0
You will notice that the generate plugin created a directory with the same name given as the -pr option. Change into that directory.
> cd example
The generate plugin created the following standard project structure.
example
|-- myproject.conf
`-- create
|-- orcl
| `-- dat
| `-- dev
| `-- environment.sql
| `-- prod
| `-- environment.sql
| `-- test
| `-- environment.sql
| `-- uat
| `-- environment.sql
| `-- version.sql
| `-- ddl
| `-- cst
| `-- dbl
| `-- dir
| `-- fct
| `-- get_property.sql
| `-- gra
| `-- idx
| `-- jar
| `-- lib
| `-- pkg
| `-- prc
| `-- scm
| `-- seq
| `-- syn
| `-- tab
| `-- application_properties.sql
| `-- trg
| `-- application_properties_biu.sql
| `-- usr
| `-- vw
You will also notice that the generate plugin created the orcl directory with the same name given as the -d option. This folder is called the database folder.
The create/orcl/dat directory contains the project data scripts, the create/orcl/ddl directory contains the source code, and the myproject.conf is the project's Project configuration file.
The myproject.conf file is the core of a project's configuration in NoOra. It is a single configuration file that contains the majority of information required to build a project in just the way you want.
This project's myproject.conf is:
# The databases in the mysql server.
DATABASES=['orcl']
# The object folders scanned when removing database objects.
# Used by the drop plugins, the scanned folders can be found under the plugin.
# The order in the list reflects the order in which database objects are removed.
DROP_OBJECTS= ['scm','usr','vw','syn','trg','typ','tab','prc','fct','pkg','jar','seq','idx','dbl']
# The object folders scanned during the creation of the database objects, typically create or update.
# The folders under the create or alter folder(s).
# The order in the list reflects the order in which database objects are created.
CREATE_OBJECTS= ['usr','dbl','lib','dir','scm','seq','syn','tab','cst','fct','prc','pkg','jar','vw','trg','idx','gra']
# Contains the mysql hosts, with their corresponding database, username and password.
MYSQL_USERS=[['localhost','orcl','apps','apps']]
# The environment descriptor used, when no environment descriptor is given.
# Normaly this is the development environment.
DEFAULT_ENVIRONMENT='dev'
# Contains a list of valid mysql server hosts for this database project.
MYSQL_HOSTS=['localhost']
# Contains a list of blocked mysql server hosts.
# Blocked hosts can not be dropped.
# Normaly this variable contains the host of your production environment.
BLOCKED_HOSTS=[]
VERSION_DATABASE='orcl'
# excluded extensions
EXCLUDED_EXTENSIONS=['bak','~','pyc','log']
# excluded folder
EXCLUDED_FOLDERS=['.svn','hotfix']
# excluded files
EXCLUDED_FILES=['install.sql']
# Environments available for this database project
ENVIRONMENTS=['dev','test','uat','prod']
# The database which controls the verioning of the database project.
VERSION_DATABASE='orcl'
VERSION_UPDATE_STATEMENT="update application_properties set value='<version>' where name='application.version';"
VERSION_INSERT_STATEMENT="insert into application_properties(name,value) values ('application.version','<version>');"
VERSION_SELECT_STATEMENT="select value into l_value from application_properties where name='application.version';"
ENVIRONMENT_INSERT_STATEMENT="insert into application_properties(name,value) values ('application.environment','<environment>');"
ENVIRONMENT_SELECT_STATEMENT="select value into l_value from application_properties where name='application.environment';"
# Reflects the create version of the database project.
DEFAULT_VERSION='1.0.0'
PLUGINS=['org.noora.plugin.mysql.create.CreatePlugin.CreatePlugin'
,'org.noora.plugin.mysql.drop.DropPlugin.DropPlugin'
,'org.noora.plugin.mysql.update.UpdatePlugin.UpdatePlugin'
,'org.noora.plugin.mysql.generate.GeneratePlugin.GeneratePlugin'
,'org.noora.plugin.mysql.recreate.RecreatePlugin.RecreatePlugin]
You executed the NoOra plugin generate. The generate plugin created the database project folder, the project tree and initiated the myproject.conf file.
> mynoora create -h=localhost
The command line will print out various actions, the following is shown.
creating database 'orcl' on host 'localhost' using environment 'dev'
/example/create/orcl/ddl/tab/application_properties.sql
/example/create/orcl/ddl/fct/get_property.sql
/example/create/orcl/ddl/trg/application_properties_biu.sql
/example/create/orcl/dat/version.sql
/example/create/orcl/dat/dev/environment.sql
database 'orcl' created.
> mynoora.py drop -h=localhost
The command line will print out various actions, the following is shown.
dropping database 'orcl' on host 'localhost' using environment 'dev'
/noora/src/org/noora/plugin/mysql/drop/vw/drop_views.sql
/noora/src/org/noora/plugin/mysql/drop/tab/drop_tables.sql
/noora/src/org/noora/plugin/mysql/drop/fct/drop_functions.sql
database 'orcl' dropped.
On your command line, perform the following:
> noora.py generate -pr=my_project_db -si=orcl -sc=apps -u=apps -p=apps -v=1.0.0
You will notice that the generate plugin created a directory with the same name given as the -pr option. Change into that directory.
> cd my_project_db
The generate plugin created the following standard project structure.
my-project-db
|-- project.conf
`-- create
|-- apps
| `-- dat
| `-- dev
| `-- environment.sql
| `-- prod
| `-- environment.sql
| `-- test
| `-- environment.sql
| `-- uat
| `-- environment.sql
| `-- version.sql
| `-- ddl
| `-- cst
| `-- dbl
| `-- dir
| `-- fct
| `-- gra
| `-- idx
| `-- jar
| `-- lib
| `-- app_prop_1.0.0.zip
| `-- pkg
| `-- prc
| `-- scm
| `-- seq
| `-- syn
| `-- tab
| `-- trg
| `-- usr
| `-- vw
You will also notice that the generate plugin created the ''apps'' directory with the same name given as the -sc option. This folder is called the scheme folder. The name of this folder can differ from actual scheme in the database, which is set with the -u option.
The ''create/apps/dat'' directory contains the project data scripts, the ''create/apps/ddl'' directory contains the source code, and the project.conf is the project's Project configuration file.
The project.conf file is the core of a project's configuration in NoOra. It is a single configuration file that contains the majority of information required to build a project in just the way you want.
This project's project.conf is:
# Contains the version of the database project
# only used by the static plugins.
VERSIONS=[]
# Contains the schemes of the database project.
SCHEMES=['apps']
# Contains the object types used by the drop plugin.
# These reflect the folders to scan in the drop tree. See the folder plugins/static/drop
# The given order is the order in which the objects will be removed from the database.
DROP_OBJECTS= ['scm','usr','vw','syn','trg','typ','tab','prc','fct','pkg','jar','seq','idx','dbl']
# Contains the object types used by the create, update plugins.
# These reflect the folders to scan in the create and alter tree. For example create/apps/ddl or alter/apps/ddl.
# The given order is the order in which the objects will be created or updated in the database.
CREATE_OBJECTS= ['usr','dbl','lib','dir','scm','seq','syn','tab','cst','fct','prc','pkg','jar','vw','trg','idx ','gra']
# Contains the oracle sids, with the schemes, usernames and passwords.
ORACLE_USERS=[['orcl','apps','apps','apps']]
# Contains the default environment to use, when no environment is given.
DEFAULT_ENVIRONMENT='dev'
# Contains the list of oracle sids for this database project.
ORACLE_SIDS=['orcl']
# Contains a list of blocked oracle sids.
# Blocked sids can not be dropped.
# Normaly this variable contains the oracle sid of your production environment.
BLOCKED_ORACLE_SIDS=[]
# Contains the excluded extensions.
# These extensions are skipped by the plugins.
EXCLUDED_EXTENSIONS=['bak','~','pyc','log']
# Contains the excluded folders.
# The folders are skipped by the plugins.
EXCLUDED_FOLDERS=['.svn','hotfix']
# Contains the excluded files
# These files are skipped by the plugins.
EXCLUDED_FILES=['install.sql']
# Contains the list of enviroments valid for this project.
ENVIRONMENTS=['dev','test','uat','prod']
# Contains the schema which will hold the version of the database project.
VERSION_SCHEME='apps'
VERSION_UPDATE_STATEMENT="update application_properties set value='<version>' where name='application.version';"
VERSION_INSERT_STATEMENT="insert into application_properties(id,name,value) values (application_properties_s.nextval,'application.version','1.0.0');"
VERSION_SELECT_STATEMENT="select value into l_value from application_properties where name='application.version';"
ENVIRONMENT_INSERT_STATEMENT="insert into application_properties(id,name,value) values (application_properties_s.nextval,'application.environment','<environment>');"
ENVIRONMENT_SELECT_STATEMENT="select value into l_value from application_properties where name='application.environment';"
# Contains the default version of the database project. In other words the version of the create tree.
DEFAULT_VERSION='1.0.0'
# Contains the list of plugins to use for this database project.
PLUGINS= ['dynamic.generate.GeneratePlugin.GeneratePlugin','static.drop.DropPlugin.DropPlugin','static.clean.CleanPlugin.CleanPlugin','component.build.BuildPlugin.BuildPlugin','dynamic.create.CreatePlugin.CreatePlugin','static.unittest.UnitTestPlugin.UnitTestPlugin','dynamic.update.UpdatePlugin.UpdatePlugin','dynamic.recreate.RecreatePlugin.RecreatePlugin']
You executed the NoOra plugin generate. The generate plugin created the database project folder, the project tree and initiated the project.conf file.
> noora.py create -s=orcl
The command line will print out various actions, the following is shown.
creating scheme 'apps' in database 'orcl' using environment 'dev'
/create/apps/ddl/lib/app_prop_1.0.0.zip
/create/apps/dat/version.sql
/create/apps/dat/dev/environment.sql
scheme 'apps' created.
compiling scheme 'apps' in database 'orcl' using environment 'dev'
scheme 'apps' compiled.
> noora.py drop -s=orcl
The command line will print out various actions, the following is shown.
dropping scheme 'apps' in database 'orcl' using environment 'dev'
apps:/plugins/static/drop/scm/drop_schemas.sql
apps:/plugins/static/drop/vw/drop_views.sql
apps:/plugins/static/drop/syn/drop_synonyms.sql
apps:/plugins/static/drop/trg/drop_triggers.sql
apps:/plugins/static/drop/typ/drop_types.sql
apps:/plugins/static/drop/tab/drop_tables.sql
apps:/plugins/static/drop/prc/drop_procedures.sql
apps:/plugins/static/drop/fct/drop_functions.sql
apps:/plugins/static/drop/pkg/drop_packages.sql
apps:/plugins/static/drop/jar/drop_jars.sql
apps:/plugins/static/drop/seq/drop_sequences.sql
apps:/plugins/static/drop/idx/drop_indexes.sql
apps:/plugins/static/drop/dbl/drop_database_links.sql
scheme 'apps' dropped.
> noora.py drop -h
The command line will print out various actions, the following is shown.
drops the database objects of the defined schemes.
-s= --sid= required contains the tnsname of the database.
-u= --scheme= not required, contains the scheme of
the database objects to drop.
-e= --env= not required, used for mapping
the username and password.