Script Oracle

How to Restore Oracle Database using RMAN (with Examples)

As a Linux sysadmin, you might recover a system from backup, which may include Oracle Database. So, it is essential for all admins to understand how to restore oracle database from backup. Typically, DBAs will use Oracle RMAN utility to take a hot backup of the database. This tutorial provides an...

Update in Oracle with Join and Multiples tables

SQL> update (select ename, dname           from emp e, dept d          where e.deptno = d.deptno            and empno = 7788)    set ename = 'X', dname = 'Y'

Identify Oracle Version from your server

SELECT * FROM V$VERSION; SELECT version FROM V$INSTANCE; BEGIN DBMS_OUTPUT.PUT_LINE(DBMS_DB_VERSION.VERSION || '.' || DBMS_DB_VERSION.RELEASE); END;

ORA-00845: MEMORY_TARGET error installing Oracle XE on Mint and Ubuntu

As you are probably aware, Mint is based on Ubuntu. No doubt you are also aware that from 11.10, Ubuntu changed the way systemd worked. You didn’t know that ? No, I must confess that it passed me by as well. Anyway, the upshot of this is that, without getting too technical, they’ve moved stuff...

Installing Oracle 11G on Linux Ubuntu

First of all you have to install these packages:   Install the required software packages: sudo apt-get install libaio1 sudo apt-get install libaio-dev sudo apt-get install unixODBC sudo apt-get install unixODBC-dev sudo apt-get install expat sudo apt-get install...

Fix the error on VM Oracle with machine that has vt-xamd-v-hardware-acceleration option

To sort it out, follow this procedure:   Today's tip lists the most common causes of VirtualBox's dread "VT-x/AMD-V hardware acceleration is not available on your system" error. This error generally makes an appearance during OS installs to a machine, or shortly after starting a new VM the...

Oracle Editor - Show Procedure / Package Details

select * from all_objects where object_type = 'PROCEDURE' AND OWNER = 'OWNER_NAME' select * from all_objects where OWNER = 'OWNER_NAME'  ORDER BY 2SELECT TEXT FROM USER_SOURCE WHERE NAME = 'PROCEDURE_NAME' ORDER BY Line;

SQLPLUS Straight connection

Use this command to log in with SQL plus:sqlplus {username}/{password}@//{ip}:{port}/{SID}sample:sqlplus test_username/test_password@//192.168.0.12:1521/val

Mostra o IP do servidor Oracle

select UTL_INADDR.get_host_address() from dual;

Show the local machine - Oracle - Query

select * sys_context('USERENV','HOST') from dual;

1 | 2 | 3 | 4 >>

Script SQL

Backup Simples de Múltiplos Datafiles

27/06/2014 16:49
  Este exemplo gera backup em múltiplos arquivos de backup   BACKUP DATABASE [CUSTO] TO   DISK = N'N:\MSSQL2005\BACKUP\CUSTO\CUSTO_1_4.bak', DISK = N'N:\MSSQL2005\BACKUP\CUSTO\CUSTO_2_4.bak', DISK = N'N:\MSSQL2005\BACKUP\CUSTO\CUSTO_3_4.bak', DISK =...

Restore de Múltiplos Datafiles

26/06/2014 19:45
  Este script torna indisponível o banco, realiza o restore de múltiplos datafiles e ativa todos os logins existentes nele.     USE [master] GO ALTER DATABASE [CUSTO_PRE_PROD] SET  RESTRICTED_USER WITH ROLLBACK IMMEDIATE GO   RESTORE DATABASE...

Gere o resultado de uma query em uma linha única separado por string TSQL

20/06/2014 13:59
  Este script mostra como gerar um resultado único separado por "|" pipe, substitua a tabela temporária pela sua tabela de trabalho e referencie a coluna correta:     Query Exemplo (Base): ======================= SELECT      ...

Pesquisar via TSQL ignorando acentuação

17/06/2014 17:07
  Segue exemplo para  pesquisar ignorando acentuação: SELECT nome FROM (select 'Carlão' as Nome) X WHERE nome LIKE 'Carlao%' COLLATE SQL_Latin1_General_CP1_CI_AI    

Verifica os últimos status dos Jobs - SQL Server

16/06/2014 10:54
  Este script é utilizado para informar o último status de execução de um    USE msdb GO /* Consulta que informa o status da ultima execução de cada job Esta deve ser executada diáriamente */ SELECT Name,  CONVERT(DATETIME, MAX(lastrun)) AS [LastRun], CASE...

Performance

SQL Server Profile - Collect Triggers

Through the SQL Profile, enable the indicators: Stored procedures: - SP:StmtStarting - SP:StmtCompleted  

SQL Scripts - Best Practices from Microsoft - Performance Analyse

--Collection of Useful T-SQL Scripts for Database Administrators --Most ExecutedSELECT TOP 5 execution_count, Plan_handle, query_plan, TEXTFROM sys.dm_exec_query_stats AS qsCROSS APPLY sys.dm_exec_query_plan(qs.plan_handle)CROSS APPLY sys.dm_exec_sql_text(qs.plan_handle)ORDER BY...

SQL SERVER – Find Most Expensive Queries Using DMV

SELECT TOP 10 SUBSTRING(qt.TEXT, (qs.statement_start_offset/2)+1, ((CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.TEXT) ELSE qs.statement_end_offset END - qs.statement_start_offset)/2)+1), qs.execution_count, qs.total_logical_reads,&nb

SQL SERVER – Index Levels and Delete Operations – Page Level Observation

USE tempdb GO -- Create Table FragTable CREATE TABLE FragTable (ID CHAR(800), FirstName CHAR(2000), LastName CHAR(3000), City CHAR(2200)) GO -- Create Clustered Index CREATE CLUSTERED...

SQL SEVER – Finding Memory Pressure – External and Internal

SELECT TYPE, SUM(single_pages_kb) InternalPressure,SUM(multi_pages_kb) ExtermalPressure FROM sys.dm_os_memory_clerks GROUP BY TYPE ORDER BY SUM(single_pages_kb) DESC, SUM(multi_pages_kb) DESC GO

Ganhe até 30% de performance dos discos do servidor de banco de dados

  Nesse post irei comentar sobre a importância de se fazer o alinhamento dos discos para obter melhor performance com o volume de dados no SQL Server.  Antes de falar sobre a importância do alinhamento de discos, precisamos antes saber algumas nomenclaturas importantes. Abaixo adicionei...

A DBA guide to SQL Server performance troubleshooting – Part 2 – Monitoring utilities

In this article, we will present native Windows and SQL Server tools commonly used for troubleshooting SQL Server performance issues. Selecting the right performance monitoring utility depends on your monitoring goals and coding knowledge, as the tools provide different information and have...

A DBA guide to SQL Server performance troubleshooting – Part 1 – Problems and performance metrics

  Monitoring SQL Server performance is a complex task, as performance depends on many parameters, both hardware and software. It’s recommended to monitor these parameters proactively in order to prevent any potential performance degradation. However, this is not always the case. If the...

Perfmon: SQL Server memory performance metrics – Part 2 – available bytes, total server, and target server memory

In the first part of this series, we started with most important SQL Server performance memory metrics. We described Pages/sec and Page faults/sec, what they indicated, and what the normal values were In this part, we will present three more memory metrics that affect SQL...

Perfmon: SQL Server memory performance metrics – Part 1 – Memory pages/sec and Memory page faults/sec

In the SQL Server performance basics article, we explained why performance monitoring was important and what you should consider before you start monitoring SQL Server performance   Different environments and applications require different metrics to be measured. The first task is...

1 | 2 >>

Enquete

Qual é o melhor SGBD, Oracle ou SQL Server?

Oracle (11)
44%

SQL Server (14)
56%

Total de votos: 25

Script SQL

Backup Simples de Múltiplos Datafiles

27/06/2014 16:49
  Este exemplo gera backup em múltiplos arquivos de backup   BACKUP DATABASE [CUSTO] TO   DISK = N'N:\MSSQL2005\BACKUP\CUSTO\CUSTO_1_4.bak', DISK = N'N:\MSSQL2005\BACKUP\CUSTO\CUSTO_2_4.bak', DISK = N'N:\MSSQL2005\BACKUP\CUSTO\CUSTO_3_4.bak', DISK =...

Restore de Múltiplos Datafiles

26/06/2014 19:45
  Este script torna indisponível o banco, realiza o restore de múltiplos datafiles e ativa todos os logins existentes nele.     USE [master] GO ALTER DATABASE [CUSTO_PRE_PROD] SET  RESTRICTED_USER WITH ROLLBACK IMMEDIATE GO   RESTORE DATABASE...

Gere o resultado de uma query em uma linha única separado por string TSQL

20/06/2014 13:59
  Este script mostra como gerar um resultado único separado por "|" pipe, substitua a tabela temporária pela sua tabela de trabalho e referencie a coluna correta:     Query Exemplo (Base): ======================= SELECT      ...

Pesquisar via TSQL ignorando acentuação

17/06/2014 17:07
  Segue exemplo para  pesquisar ignorando acentuação: SELECT nome FROM (select 'Carlão' as Nome) X WHERE nome LIKE 'Carlao%' COLLATE SQL_Latin1_General_CP1_CI_AI    

Verifica os últimos status dos Jobs - SQL Server

16/06/2014 10:54
  Este script é utilizado para informar o último status de execução de um    USE msdb GO /* Consulta que informa o status da ultima execução de cada job Esta deve ser executada diáriamente */ SELECT Name,  CONVERT(DATETIME, MAX(lastrun)) AS [LastRun], CASE...

Script Oracle

How to Restore Oracle Database using RMAN (with Examples)

As a Linux sysadmin, you might recover a system from backup, which may include Oracle Database. So,...

Update in Oracle with Join and Multiples tables

SQL> update (select ename, dname           from emp e, dept...

Identify Oracle Version from your server

SELECT * FROM V$VERSION; SELECT version FROM V$INSTANCE; BEGIN...

ORA-00845: MEMORY_TARGET error installing Oracle XE on Mint and Ubuntu

As you are probably aware, Mint is based on Ubuntu. No doubt you are also aware that from 11.10,...

Installing Oracle 11G on Linux Ubuntu

First of all you have to install these packages:   Install the required software...

Fix the error on VM Oracle with machine that has vt-xamd-v-hardware-acceleration option

To sort it out, follow this procedure:   Today's tip lists the most common causes of...

Oracle Editor - Show Procedure / Package Details

select * from all_objects where object_type = 'PROCEDURE' AND OWNER = 'OWNER_NAME' select * from...

SQLPLUS Straight connection

Use this command to log in with SQL plus:sqlplus...

Mostra o IP do servidor Oracle

select UTL_INADDR.get_host_address() from dual;

Show the local machine - Oracle - Query

select * sys_context('USERENV','HOST') from dual;

Itens: 1 - 10 de 33

Crie um site com

  • Totalmente GRÁTIS
  • Centenas de templates
  • Todo em português

Este site foi criado com Webnode. Crie um grátis para você também!