Monday, October 12, 2020

Create Oracle READ ONLY account

CREATE USER READ_ONLY IDENTIFIED BY "password";


GRANT CREATE SESSION TO READ_ONLY;




SET HEADING OFF


SET PAGES 9999 LINES 400


SPOOL TABLE_GRANTS.sql


SELECT 'GRANT READ ON ' || OWNER || '.' || TABLE_NAME || ' TO READ_ONLY;'

FROM DBA_TABLES

WHERE OWNER IN ('PRESS')

ORDER BY 1;


SELECT 'CREATE SYNONYM RO_CAPEX.'||TABLE_NAME|| ' FOR ' || OWNER || '.' || TABLE_NAME || ';'

FROM DBA_TABLES

WHERE OWNER IN ('PRESS')

ORDER BY 1;




SPOOL OFF


@TABLE_GRANTS.sql


!rm TABLE_GRANTS.sql

Tuesday, October 6, 2020

Oracle SOX Users

--Password History


select

  name,

   password_date

from

   sys.user$,

   sys.user_history$

where

   user$.user# = user_history$.user#;

   

--Password Expired

   

 select name,type#,ptime,exptime,ltime, lcount from sys.user$ where type#=1;

 

 select name,type#,ptime,exptime from sys.user$ where type#=1 order by exptime;

 

 


--Password history 

 select

  name,

   password_date

from

   sys.user$,

   sys.user_history$

where

name='DAV4635'

and

user$.user# = user_history$.user#;


--show logon failures

select dbusername,client_program_name,terminal,os_username,action_name, unified_audit_policies from unified_audit_trail 

where unified_audit_policies='ORA_LOGON_FAILURES' order by event_timestamp desc ;

 

Thursday, October 1, 2020

How to connect mariadb to powerbi

 

Dennis asked me to help in connection POWER BI to Nagios

 

Follow this steps

 

1.       Download MariaDB connector https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.1.9/  or use the attached one.

2.       Install mariadb

3.       Choose typical >Install>finish

4.       Open ODBC 64 bit

5.       Add> Maria DB ODBC> Finish

6.       Name: Nagios_Test

7.       


8.      



9.       User:ro_chow/dropwater

10.   Click Next until finish

11.   Connect using Power BI

12.   


13.   cid:image005.png@01D69827.47C1FB90

 

Have fun!!!

How to create user in mysql

 mysql -u root -p'nagiosxi'

  

  MariaDB [nagiosxi]> create user 'ro_chow'@'%' identified by 'dropwater';

Query OK, 0 rows affected (0.05 sec)


MariaDB [nagiosxi]> grant select on nagiosxi.* to 'ro_chow'@'%';

Query OK, 0 rows affected (0.00 sec)


MariaDB [nagiosxi]> flush privileges;



Type CREATE USER 'troy'@'%' IDENTIFIED BY 'troypassword'; and press Enter

o Type GRANT ALL PRIVILEGES ON *.* TO 'troy'@'%' WITH GRANT OPTION; and press Enter

o Type CREATE USER 'troy'@'localhost' IDENTIFIED BY 'troy'; and press Enter

o Type GRANT ALL PRIVILEGES ON *.* TO 'troy'@'localhost' WITH GRANT OPTION; and press Enter

o Type exit and press Enter



CREATE USER 'tony'@'%' IDENTIFIED BY 'Password'; and press Enter

o Type GRANT ALL PRIVILEGES ON *.* TO 'tony'@'%' WITH GRANT OPTION; and press Enter

o Type CREATE USER 'tony'@'localhost' IDENTIFIED BY Password'; and press Enter

o Type GRANT ALL PRIVILEGES ON *.* TO 'tony'@'localhost' WITH GRANT OPTION; and press Enter

o Type exit and press Enter

Thursday, September 24, 2020

How to run sqlcmd as another network user

 Open a command prompt

C:\WINDOWS\system32>runas /user:ecp\admdvelasco cmd.exe

this will open another window

Microsoft Windows [Version 10.0.16299.1087]

(c) 2017 Microsoft Corporation. All rights reserved.


C:\WINDOWS\system32>sqlcmd -S spectre

1> select name from sys.databases

2> go

name                                                                                                                    

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

master                                                                                                                  

tempdb                                                                                                                  

model                                                                                                                   

msdb                                                                                                                    

eTraceOneToOne