0% found this document useful (0 votes)
4 views3 pages

Resolving Oracle User Name Errors

Uploaded by

Diego Rayklash
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Resolving Oracle User Name Errors

Uploaded by

Diego Rayklash
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

------- ORACLE REFERENCE --------

--------------SQL PLUS
sqlplus system/admin@localhost:1521/XE

sqlplus SIF/temporal@localhost:1521/xe

sqlplus system/admin@localhost:1521/XE <<< 'select sysdate from dual;'

-------------

sqlplus SIF/temporal@[Link]:1781/GENTEC

--------------- get DB Version

select * from v$version

--------- ORACLE ---------------

------ CHANGE SYSDATE --------

ALTER SYSTEM SET FIXED_DATE='2023-09-01-00:00:00';

RESET SYSDATE

ALTER SYSTEM SET FIXED_DATE=NONE

SELECT SYSDATE FROM DUAL;

-------- SQL PLUS ----------------

SQLPLUS :
login dba -- sqlplus system/admin@localhost:1521/xe
login sif -- sqlplus SIF/temporal@localhost:1521/xe

SQLPLUS -- TNS - Unable to load ERROR


Solucion : Definir ORACLE_BASE , ORACLE_HOME / Iniciar consola como ADMIN

ORA-65096: invalid common user or role name ERROR


Solucion : alter session set “_ORACLE_SCRIPT”=true;
------- CREATE USER

Create user
CREATE USER SIF IDENTIFIED BY temporal

------- GRANTS

Assign grant SYSTEM privileges:

GRANT ALL PRIVILEGES TO SIF;

GRANT create session TO SIF;


GRANT create table TO SIF;ex
GRANT create view TO SIF;
GRANT create any trigger TO SIF;
GRANT create any procedure TO SIF;
GRANT create sequence TO SIF;
GRANT create synonym TO SIF;

GRANT insert to SIF;

Assig grants to specific user :

GRANT ALL ON some_table TO SIF;

-------- basic trigger

-- lasmod time

CREATE OR REPLACE TRIGGER update_timestamp


BEFORE INSERT OR UPDATE ON some_table
FOR EACH ROW
BEGIN
:[Link] := systimestamp;
END;

---------------------------

Batch update returned unexpected row count from update [0]; actual row count: 3;
expected: 1

-------------- ALTER A TABLE --------------

-- DELETE COLUMN
----- Modify column -----
--Size

ALTER TABLE [Link]


MODIFY FCVALOR VARCHAR2( 250 ) NOT NULL;

-------------------------

--- SPRING:: Log HIBERNATE OUTPUT


----------

[Link]-sql=true
[Link].format_sql=true

[Link]=DEBUG
[Link]=TRACE
[Link]=TRACE

Common questions

Powered by AI

Common error codes in Oracle SQL Plus include ORA-65096: invalid common user or role name, which can be resolved by setting the session parameter: alter session set "_ORACLE_SCRIPT"=true;, and 'TNS: unable to load error,' which can be resolved by properly defining ORACLE_BASE and ORACLE_HOME and starting the console as an administrator .

To ensure that a table column in Oracle has a defined maximum size and is specified as not nullable, you use the ALTER TABLE command. For instance, ALTER TABLE table_name MODIFY column_name VARCHAR2(size) NOT NULL; where 'table_name' is the name of your table, 'column_name' is the column you are modifying, and 'size' is the maximum number of characters permitted .

Batch update operations in Oracle might return unexpected results when the actual row count differs from the expected row count. For example, a batch update might expect to update a certain number of rows but results in an update count of zero or higher than expected, which could indicate data integrity issues, logical errors in the update criteria, or potential version control and conflict resolution problems in concurrent environments .

The SQL command SELECT SYSDATE FROM DUAL; can be used to retrieve the current system date in Oracle. This can be important in database management for auditing purposes, temporal data tracking, or calculating age of data entries. It provides a reliable timestamp that reflects system time, aiding in consistency and accuracy of data management .

To set the Oracle system date to a fixed value, you can use the command ALTER SYSTEM SET FIXED_DATE='YYYY-MM-DD-HH24:MI:SS'; where you replace 'YYYY-MM-DD-HH24:MI:SS' with your desired date and time. To revert the system date back to the current date and time, use the command ALTER SYSTEM SET FIXED_DATE=NONE .

To log detailed SQL statements and transaction traces in Spring with Hibernate, you can set the properties in your application's configuration file: spring.jpa.show-sql=true to enable SQL output logging, spring.jpa.properties.hibernate.format_sql=true to format SQL logs, and enable DEBUG level logs for specific packages such as logging.level.org.hibernate.SQL=DEBUG and logging.level.org.springframework.transaction=TRACE to see detailed transaction logs .

To create a new user in Oracle, you use the command CREATE USER user_name IDENTIFIED BY password; where you replace 'user_name' and 'password' with your desired username and password. After creating the user, privileges need to be assigned to define what operations they can perform. You can grant system privileges such as GRANT ALL PRIVILEGES TO user_name;, GRANT create session, GRANT create table, and others that allow for creating various database objects and managing data .

A trigger in Oracle is a stored procedure that is automatically executed in response to certain events on a particular table or view. They are useful for enforcing business rules, maintaining audit trails, and synchronizing data. For example, the trigger CREATE OR REPLACE TRIGGER update_timestamp BEFORE INSERT OR UPDATE ON some_table automatically updates the timestamp column TS with the current time whenever a row is inserted or updated .

You might also like