Prepare / Generate repetitive SQL Scripts Using Microsoft EXCEL CONCATENATE Function

advertisements

_____________________________________________________________________________________________________________________

The Eucharistic Miracles of the World
Suppose if you wanted to create a series users like user1 to user100 with default tablespace is USER and temporary tablespace TEMP. I mean all the details for these users are same apart from the user name and password. In this scenario you can create the scripts using Microsoft Excel Concatenate function.


  1. Open a New excel spread sheet.
  2. In Column A populate the usernames from User1 to User100. You can use fill series option to generate n number of users.
  3. In Column B enter the following formula and copy the formula upto B100th column. This will generate the user creation scripts.
=CONCATENATE ("Create user ",A1," identified by ",A1," default tablespace users temporary tablespace temp;")
  1. In Column C enter the following formula and copy the formula upto C100th column which will generate the tablespace quota scripts.
=CONCATENATE ("ALTER USER ",A1," QUOTA UNLIMITED ON USERS;")
  1. In Column D enter the following formula and copy the formula upto D100th column which will generate the grant scripts.
=CONCATENATE ("grant connect, resource to ",A1,";")
  1. Copy the generated scripts into a .sql file and you can run it on SQL prompt.

_____________________________________________________________________________________________________________________

A visitor from Oslo viewed 'Data Guard / Standby: ORA-01156: recovery or flash' 14 mins ago
A visitor from New york viewed 'Steps to Enable fast_start failover (automatic) in' 52 mins ago
A visitor from Raleigh viewed 'DBMS_SCHEDULER. Create_job Fails with ORA-06512 OR' 1 hr 57 mins ago
A visitor from Khouribga viewed 'Data Pump impdp expdp : SQLFILE option to extract ' 2 hrs 2 mins ago
A visitor from Chandigarh viewed 'RMAN-08591: WARNING: invalid archived log deletion' 2 hrs 55 mins ago

0 comments:

Post a Comment

Labels

Oracle (629) Script (86) General (77) Unix (47) Blog (23) Technology (19) gadget (6) games (6) Business (3) OCI (3) SQL* Loader (3) Datapump (2)
 

acehints.com Copyright 2011-25 All Rights Reserved | Site Map | Contact | Disclaimer