SQL Language (MOSC)

MOSC Banner

How to define username and password in a sql session

edited Dec 6, 2017 6:07PM in SQL Language (MOSC) 12 commentsAnswered ✓

I have a text file like this

C:

cd C:\password\test

set conn_str=abc/abc

sqlplus %conn_str%@mydb

Column a new_val dbname

Column b new_val currdate

Select     upper(sys_context('userenv','db_name')) a,

    to_char(sysdate, 'yyyymmdd.hh24miss') b

from dual;

Spool &dbname..&currdate..log

ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';

set timing on

set serveroutput on

set define off

set linesize 100 pagesize 100

column owner format a30

column Object_Type format a30

column Object_Name format a30

select owner || '.' || object_type || '.' || Object_Name

from  dba_objects

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center