Click here to Skip to main content
15,881,863 members
Articles / General Programming
Tip/Trick

Dynamically Creating User Schema with User Supplied Password using Batch Programming

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
28 Jun 2013CPOL 6K   2  
This tip helps in creating User schema with fresh password on the fly

Introduction

In this tip, we will see how we can setup the whole production level schema using Batch processing. You will be surprised to see how easy and simple the implementation is.

Background

During our onsite PADSS assessment, our PA QSA suddenly requested to freshly create our schema using his own supplied passwords (our application uses more than 10 Oracle Schemas). Previously, we had created user schemas using hardcoded passwords.

This critical gap could hit our assessment hard and we had to have a solution that could work in hours.

Using the Code

We immediately thought of batch processing as an immediate remedy and it worked. Below is the sample batch file that we used. The whole idea was to take password as user input and forward it as parameter to core files which will take that parameter and process the DDL.

REM FOR SYS 

@ECHO OFF

SET /P sysPwd=Please enter SYS Password: 
IF "%sysPwd%"=="" GOTO Error

REM FOR TEST_USER

SET /P testUserPwd=Please enter TEST_USER Password: 
IF "%testUserPwd%"=="" GOTO Error

sqlplus SYS/"%sysPwd%"@Omni AS SYSDBA @C:\Scripts\01-TestUserScript.sql %testUserPwd%   

01-TestUserScript.sql constant can be like this:

CREATE USER CORE_BANKING_INTERFACE
    IDENTIFIED BY &1
    PROFILE USER_PROFILE
    ACCOUNT UNLOCK; 

Here we provided password as &1 parameter which is a different batch file.

This quick approach gave immediate relief to us leading to no critical gap in this area.
History

  • 6/28/2013: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Product Manager Avanza Solutions
Pakistan Pakistan
Asif embarked on his programming journey back in 1991 when he first encountered 80286 8-16 MHz systems. His programming repertoire began with dBase III+, FoxPro, C, and assembly language, where he honed exceptional skills that have been a cornerstone of his development career.

Over the years, Asif's programming saga has seen him delve into a wide array of technologies and languages, ranging from C++, VC++, Java, Delphi, RPG400, SQL Server, and Oracle, to name just a few. His insatiable curiosity continues to lead him towards newer horizons, such as DOT Net Technologies, SOA architectures, BI, DSL, and beyond. These learning experiences are underscored by a robust theoretical foundation, with a penchant for research.

Beyond the realm of technology, Asif's interests include delving into the pages of fiction, exploring biotechnology, and gazing at the wonders of Astronomy. He finds joy in watching movies, and during his free time, he delights in quality moments spent with his children.

Comments and Discussions

 
-- There are no messages in this forum --