---
title: ALTER EXTERNAL LOCATION
description: Change the properties of or rename an external location with ALTER EXTERNAL LOCATION in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-alter-location
---

# ALTER EXTERNAL LOCATION

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime 10.4 LTS and above ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Unity Catalog only

Alters properties of an [external location](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-external-locations.md) or renames the location.

## Permissions

To alter an external location, you must have the `MANAGE` privilege on the location or be its owner.

## Syntax

```
ALTER EXTERNAL LOCATION location_name
   { RENAME TO to_location_name |
     SET URL url_str [ FORCE ] |
     SET STORAGE CREDENTIAL credential_name |
     [ SET ] OWNER TO principal }
```

Any object name that includes special characters, such as hyphens (`-`), must be surrounded by backticks (`` ` ` ``). Object names with underscores (`_`) don't require backticks. See [Names](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md) and [Examples](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-alter-location.md#example).

## Parameters

* **[location\_name](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md#location-name)**

  Identifies the external location being altered.

* **RENAME TO [to\_location\_name](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md#location-name)**

  Renames the location. The name must be unique among all locations in the metastore.

* **SET URL url\_str \[ FORCE ]**

  `url_str` must be a `STRING` literal with the location of the cloud storage described as an absolute URL.

  Unless you specify `FORCE` the statement will fail if the location is currently in use.

* **SET STORAGE CREDENTIAL [credential\_name](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md#credential-name)**

  Updates the named credential used to access this location. If the credential does not exist Databricks SQL raises an error.

* **\[ SET ] OWNER TO [principal](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-principal.md)**

  Transfers ownership of the storage location to `principal`.

  **Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime 11.3 LTS and above

  `SET` is allowed as an optional keyword.

## <a id="example" />Examples

The following examples use location names that don't include special characters, such as hyphens (`-`). Any object name that includes special characters must be surrounded by backticks (`` ` ` ``). See [Names](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md).

```sql
-- Rename a location
> ALTER EXTERNAL LOCATION descend_loc RENAME TO decent_loc;

-- Redirect the URL associated with the location
> ALTER EXTERNAL LOCATION best_loc SET URL 's3://us-east-1-prod/best_location' FORCE;

-- Change the credentials used to access the location
> ALTER EXTERNAL LOCATION best_loc SET STORAGE CREDENTIAL street_cred;

-- Change ownership of the external location
> ALTER EXTERNAL LOCATION best_loc OWNER TO `alf@melmak.et`
```

## Related articles

* [CREATE EXTERNAL LOCATION](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-location.md)
* [DESCRIBE EXTERNAL LOCATION](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-aux-describe-location.md)
* [DROP EXTERNAL LOCATION](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-drop-location.md)
* [External locations and storage credentials](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-external-locations.md)
* [SHOW EXTERNAL LOCATIONS](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-aux-show-locations.md)
